I am new to laravel 5. I have created a form to edit users info which is populated with information from the DB. After form validation if I get an error, I lose all the info I just modified, and the db info is restored.
My form field look like below:
<input type="text" name="name" value="{{ $user->name }}" id="name" class="form-control"/>
What I would like to see happen is this. If during edit the user clears off the users name from the field and make other changes on the different fields on my form. After a validation failure, I want his recent changes to stick and not the info from the database.
NB: Because of the nature of my form, I cannot bind a model to it.
You must follow this approach:
<input type="text" name="name" value="{{ old('name', $user->name) }}" id="name" class="form-control"/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With