How to use old() in multiple select without using Form::select()

Published 7 months ago by oroalej

The title already said it all, I was able to retrieve the old form value using the Form::select(). I'm just curious if this is possible in plain html?

Also, How can you validate the multiple select? since we add "[]" to the name of the select when it's multiple, the validation doesn't work in this name. Can you guys guide me on how.

7 months ago (151,880 XP)


<select name="categories[]">
    <option value="test"{!! in_array('test', old('categories')) ? ' selected' : '' !!}>Test</option>

validation: you can use Custom Validation Rules

Please sign in or create an account to participate in this conversation.