Laravel collective select placeholder not working when multiple is to true {{ Form::select() }}

时间秒杀一切 提交于 2019-12-24 09:58:26

问题


I have a problem with Laravel collective select placeholder not working

 {{ Form::select('album',$albums,$selected, ['class'=>'form-control','placeholder'=>'select album' ]) }}

But when i allow tags to true like this using select 2, it works fine,

 {{ Form::select('tags[]',$tags,$tagged, ['data-input'=>'select2-tags','multiple'=>true]) }}

The second one works fine, I don't want the album to have multiple input attribute, What am i doing wrong?


回答1:


You can do this with select, but you can add placeholder as the value with 0 index:

$albums[0] = 'select album';

Alternatively, you can create your own select function using Laravel Collective Form macros.




回答2:


You can follow this :

 {{ Form::select('album', $album , Input::old('album'), array('placeholder' => 'Please select','class'=>'form-control')) }}


来源:https://stackoverflow.com/questions/43569986/laravel-collective-select-placeholder-not-working-when-multiple-is-to-true-fo

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!