The problem here is that the country field is not being re-populated whenever I submit the form. What I expect is for the user to submit the form and have the server validate it and redirect back with the errors and keep the data that the user input before submitting.
For some unknown reason, the country field is not getting the old input but the state field is getting the old input perfectly.
<select id="country" name ="country" class="form-control rounded input-lg text-center no-border" required autofocus <option> </option>
</select> </br>
<select name ="state" id ="state" class="form-control rounded input-lg text-center no-border" required autofocus
<option>{{ Request::old('state') }}</option>
</select> </br>
You can use just old()
helper for that:
<input type="text" name="username" value="{{ old('username') }}">
Another way to do that is to use Laravel Collective form model binding:
{!! Form::model($user, ['route' => ['user.update', $user->id]]) !!}
In this case all form data will be re-populated automatically.
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