lundi 19 mars 2018

Laravel - how to use `old` on a select or "input of type file" at validation fail

I know that you can use old('foo') in case of a failed validation, to set the value of a form field to its old value, so that users won't have to retype all their data into the form if there was a validation fail.

e.g.

<input type="text" class="form-control" id="title" name="title" value="">

But how do you make use of this feature on a select box, or on a input of type file?

e.g.

        <div class="form-group">
            <label for="brand" class="control-label">Marke</label>
            <select class="form-control" id="brand" name="brand">
                <option value='Audi'>Audi</option>
                <option value='BMW'>BMW</option>
                <option value='Mercedes-Benz'>Mercedes-Benz</option>
                <option value='Opel'>Opel</option>
                <option value='Porsche'>Porsche</option>
                <option value='Volkswagen'>Volkswagen</option>
            </select>
        </div>
        <div class="form-group">
            <input type="file" name="image[]" id="images" multiple>
        </div>

Is this even possible?



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

Aucun commentaire:

Enregistrer un commentaire