Closed ataylor32 closed 5 years ago
Here is my form:
{!! Form::open()->route('posts.update', [$post->id])->fill($post)->patch() !!} {!! Form::text('title', 'Title')->attrs(['maxlength' => '255'])->required() !!} {!! Form::textarea('body', 'Body')->attrs(['class' => 'wysiwyg'])->required() !!} <input type="hidden" name="allow_comments" value="0"> {!! Form::checkbox('allow_comments', 'Allow comments?', '1')->wrapperAttrs(['class' => 'wrapper-allow_comments']) !!} {!! Form::submit('Update Post') !!} {!! Form::close() !!}
The <form> tag that gets generated by the above code starts with <form method="patch", so the browser doesn't handle it correctly. Because of that, I need to remove ->patch() and add this to my form:
<form>
<form method="patch"
->patch()
<input type="hidden" name="_method" value="patch">
Fixed on 3.0.3 version, thanks @ataylor32 !
Tip: In your code above, you can use hidden method, to create a hidden field, this way:
{!!Form::hidden('allow_comments', '0')!!}
Here is my form:
The
<form>
tag that gets generated by the above code starts with<form method="patch"
, so the browser doesn't handle it correctly. Because of that, I need to remove->patch()
and add this to my form: