Laravel选择默认禁用选项

That i'm trying todo to disable some option in my select form. I'm using laravel 5. Code looks like:

{!! Form::smartSelectForeign('country_id', trans('app.object_country')) !!}   

Trying to add "Please select" option and trying disable to choose "Please select" option:

{!! Form::smartSelectForeign('country_id', null, array('default' => 'Please Select')) !!}

Some thing like that: jsfidle. But dosn't work. Any solutions?

I am not sure what that smartSelectForeign method is.

But if you are using the laravel collective form package you can set a placeholder like this:

{!! Form::select('country_id', trans('app.object_country'), null, ['placeholder' => 'Please Select'] ) !!}

So for your your custom method probably like this:

{!! Form::smartSelectForeign('country_id', trans('app.object_country'), null, ['placeholder' => 'Please Select'] ) !!}

Hi I have a solution but it will require some client side validation and it is working for me in laravel 5.7

{{FORM::SELECT('country_id', null, array('' => 'Please Select', 'item'=>'item','item1'=>'item1'))}}

Now add javascript

let country = $('#country_id').val();
if(country == ''){alert('country cannot be empty');}

I hope this works for you