If you are going back to a form after, say, validation failure, you can use
return Redirect::back()->withInput()->withErrors($validator);
(or)
return Redirect::to('myform')->withInput();
This re-populates the form with previously submitted data no matter what the default value is set to. If you're rendering the view again instead, you can use something like
Input::flash(); // Keeps the input for the next view
return View::make('myform');
And in the form use
Form::text('username', Input::old('username), ['disabled' => 'disabled'])
Thanks, I hoped to find a solution where I didn't have to put in every database field, but this of course works.
You can supply null as second argument to Form::text
Form::text('username', null, array('disabled' => 'disabled'))
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community