Php Laravel选择默认禁用选项

Php Laravel选择默认禁用选项,php,mysql,laravel,frameworks,Php,Mysql,Laravel,Frameworks,我试图禁用select表单中的某些选项。 我用的是拉威尔5号。 代码如下所示: {!! Form::smartSelectForeign('country_id', trans('app.object_country')) !!} 尝试添加“请选择”选项并尝试禁用“请选择”选项: 像这样的事情:。 但是不起作用。有什么解决方案吗?我不确定smartSelectForeign方法是什么 但如果您使用的是软件包,则可以设置如下占位符: {!! Form::select('country_id

我试图禁用select表单中的某些选项。 我用的是拉威尔5号。 代码如下所示:

{!! Form::smartSelectForeign('country_id', trans('app.object_country')) !!}   
尝试添加“请选择”选项并尝试禁用“请选择”选项:

像这样的事情:。
但是不起作用。有什么解决方案吗?

我不确定smartSelectForeign方法是什么

但如果您使用的是软件包,则可以设置如下占位符:

{!! Form::select('country_id', trans('app.object_country'), null, ['placeholder' => 'Please Select'] ) !!}
{!! Form::smartSelectForeign('country_id', trans('app.object_country'), null, ['placeholder' => 'Please Select'] ) !!}
因此,对于您的自定义方法,可能如下所示:

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

我不确定
smartSelectForeign
方法是什么

但如果您使用的是软件包,则可以设置如下占位符:

{!! Form::select('country_id', trans('app.object_country'), null, ['placeholder' => 'Please Select'] ) !!}
{!! Form::smartSelectForeign('country_id', trans('app.object_country'), null, ['placeholder' => 'Please Select'] ) !!}
因此,对于您的自定义方法,可能如下所示:

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

嗨,我有一个解决方案,但它将需要一些客户端验证,它是为我在laravel 5.7工作

{{FORM::SELECT('country_id', null, array('' => 'Please Select', 'item'=>'item','item1'=>'item1'))}}
现在添加javascript

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

我希望这适用于您

您好,我有一个解决方案,但它需要一些客户端验证,并且在laravel 5.7中对我有效

{{FORM::SELECT('country_id', null, array('' => 'Please Select', 'item'=>'item','item1'=>'item1'))}}
现在添加javascript

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

我希望这对你有用

有人能帮忙吗?谢谢有人能帮忙吗?谢谢