vendredi 18 mai 2018

Laravel - Validation save selected option

I have a form which has some validation. When one of these errors occurs the value of an input field will be saved be using in the value field of an input. But this is only for regular text input fields.

My problem.

How can I save the selected value of a select box using the same method? So that if the user comes across an error, Their selected option will still be selected?

The code where the selected

<select name="period_id" id="" class="form-control ">
   <option value="">Choose a period...</option>
     @foreach($plans as $plan)
     <option value="">
        
     </option>
     @endforeach
</select>

@if($errors->has('period_id'))
 <p style="color: red;"> </p>
@endif



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire