Can you post your store method from the controller and a snippet of one of the fields that doesn't get filled out?
I don't have any experience with FormRequests, but I had the same issue recently.
Check that you don't have a 301 redirect (Laravel does this if you have a trailing slash on the form action URL, and sends you to the non-slashed version) as by the time the request has redirected, the Flash message will have gone.
This tripped me up a few weeks ago - I eventually spotted it by looking in the JS console and spotting the 301 redirect message in the Network panel.
Caveat: at least I think this was what was happening!
tkprocat said:
Can you post your store method from the controller and a snippet of one of the fields that doesn't get filled out?
I have nothing in the store method. I Have another function which saves the form input in db using model->save() http://pastebin.com/RaFQ0nud (mycontroler)
In the view actually nothing get filled out. here is one of that field
<div class="form-group required"> <label for="address" class="col-sm-2 control-label" >Address</label> <div class="col-sm-5"> <textarea class="form-control" rows="2" id="address" name="address" placeholder="Your Address"></textarea> </div> </div>DO i have to something in store() function?
davestewart said:
I don't have any experience with FormRequests, but I had the same issue recently.
Check that you don't have a 301 redirect (Laravel does this if you have a trailing slash on the form action URL, and sends you to the non-slashed version) as by the time the request has redirected, the Flash message will have gone.
This tripped me up a few weeks ago - I eventually spotted it by looking in the JS console and spotting the 301 redirect message in the Network panel.
Caveat: at least I think this was what was happening!
In my case the server replies with error code 302.
form action url : method="post" action="{{ url('/request-a-repair')}}"
Laravel doesn't fill out form fields automatically. You'll need to either use a package for building forms (like illuminate/html
, or laravelcollective/html
), or fill in form values with old()
method:
<textarea class="form-control" rows="2" id="address" name="address" placeholder="Your Address">{{old('address')}}</textarea>
<input name="example" value="{{old('example')}}" />
Xum said:
Laravel doesn't fill out form fields automatically. You'll need to either use a package for building forms (like
illuminate/html
, orlaravelcollective/html
), or fill in form values withold()
method:<textarea class="form-control" rows="2" id="address" name="address" placeholder="Your Address">{{old('address')}}</textarea> <input name="example" value="{{old('example')}}" />
I added that value parameter value= "{{old('example'}}" but the value comes to be empty when i see the source page of the view. Why is it empty? something to do with redirection?. I get server status 302 error.
In my case the server replies with error code 302.
That's probably what I meant :)
form action url : method="post" action="{{ url('/request-a-repair')}}"
Looks like this won't be your issue then. Good luck in working it out
Thanks! This post was very helpful, I didn't know we have helpers like old('field_value')
to us. That's perfect. =) Good week to everybody, cheers!
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community