Support the ongoing development of Laravel.io →
posted 10 years ago
Forms
Last updated 2 years ago.
0

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'])
Last updated 2 years ago.
0

Thanks, I hoped to find a solution where I didn't have to put in every database field, but this of course works.

Last updated 2 years ago.
0

You can supply null as second argument to Form::text

Form::text('username', null, array('disabled' => 'disabled'))
Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

jakob42 jakob42 Joined 25 Jun 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.