Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

CedricBongaerts's avatar

Form Collective Select

I was wondering if there way a way to achieve this code using the select type using form collectives:

<select class="form-control chosen-type">
    <option value='type' disabled selected style='display:none;'>Please Choose</option>
     <option value='Task'>Task</option>
     <option value='Booking'>Booking</option>
</select>

In other words, not showing the placeholder as a selection type:

disabled selected style='display:none;'

When trying the following code I ofcourse get the placeholder in the list:

{!! Form::open() !!}
    {!! Form::select('type', ['Task' => 'Task', 'Booking' => 'Booking'], null, 
        ['class' => 'form-control chosen-type', 'placeholder' => 'Please Choose']) !!}
{!! Form::close() !!}
0 likes
5 replies
helmerdavila's avatar

@CedricBongaerts

<select class="form-control chosen-type" name="mySelect">
    <option disabled selected>Please Choose</option>
</select>

if no value = empty select, dont forget the name

CedricBongaerts's avatar

@helmerdavila The code above shows it in normal html, which I already have.. I want to be consitent and create all my forms through the laravel collective form code, this is where I'm having a problem

bestmomo's avatar

@CedricBongaerts create a macro to get it working or extend FormBuilder as it's not implemented in package. Send a PR if you think it could be interesting for other people.

1 like

Please or to participate in this conversation.