Reputation: 4670
I'm trying to reproduce this HTML form using Laravel Collective's HTML select:
<option value="Vehicles"style="background-color:#E9E9E9;font-weight:bold;" disabled="disabled"> - Vehicles - </option>
This is what I have in my blade:
{{ Form::select('subcategories', $subcategories, null, ['class'=>'form-control']) }}
The document here is rather limiting: https://laravelcollective.com/docs/5.3/html#drop-down-lists and doesn't indicate if individual styles or if disabling is possible.
There is a similar question here on Stackoverflow
Using Laravel Form class to add the 'disabled' attribute
where 'disabled' is discussed, but it seems for the whole select. There was in the comments section people who ask about individual items, but no clear answer.
Is this possible?
Upvotes: 1
Views: 2590
Reputation: 163858
This will disable whole select
element:
{!! Form::select('subcategories', $subcategories, null, ['disabled' => true, 'class' => 'form-control']) !!}
Update
You want to disable some of the options. It's impossible, because select()
method doesn't have such functionality
What you can do is to create macro like this one.
Upvotes: 1