jeudi 27 août 2015

Validator for varying amounts of data

I have a form with a varying number of fields. It is necessary to make a validator for this form, which verifies that all the fields between them have different values.

<form method="POST" action="url/action">
 <input type="hidden" name="_token" value="{{ csrf_token() }}">
     @for ($i = 0; $i < $num; $i++)
         <div class='form-group'>
             <label>
                 Property №{{ $i+1 }}:
                 <select name="property{{ $i }}">
                     @foreach($properties as $property)
                         <option value="{{ $property->id }}">{{ $property->name }}</option>
                     @endforeach
                 </select>
             </label>
         </div>
     @endfor
 <input type="submit" class="btn btn-primary" value="Добавить">
</form>

So, all values of select must be different from each other. Help write a validator, please.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1hiEkMc
via IFTTT

Aucun commentaire:

Enregistrer un commentaire