kevin_marcus
kevin_marcus

Reputation: 277

Laravel Form select disable first option

I have this code on my view

{!! Form::select('room', $rooms, Input::old('room'), array('class' => 'form-control')) !!}

and this on my controller

$rooms = array('' => 'Select Room') + $rooms;

I wanted the first option to be selected and disabled which is the "Select Room". I tried to put it also in array and it didn't work.

Upvotes: 1

Views: 2096

Answers (1)

Lakhwinder Singh
Lakhwinder Singh

Reputation: 5582

If you want to disable only one option from select list then you can do this in html like this:

<select>
  <option value="volvo" disabled>Volvo</option>
  <option value="saab">Saab</option>
  <option value="vw">VW</option>
  <option value="audi">Audi</option>
</select>

This will disable first option disabled.

For reff. http://www.w3schools.com/tags/att_option_disabled.asp

Upvotes: 0

Related Questions