Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel 4 blade drop-down list class attribute

Laravel blade drop down list class attribute not working.

I cannot find any reference to class or assigning attributes to select / drop-down lists in the documentation.

http://www.laravel.com/docs/html#drop-down-lists

Examples tried:

{{ Form::select('product_id', $productList, array('class'=>'form-control')) }}

{{ Form::select('product_id', $productList, $attributes = array('class'=>'form-control')) }}

Both return the same html but without the class attribute:

<select id="product_id" name="product_id">
    ... Option Stuff ...
</select>
like image 259
Gravy Avatar asked Aug 30 '13 10:08

Gravy


1 Answers

{{ Form::select('product_id', $productList, null, array('class' => 'form-control')) }}

The third parameter is the key of the currently selected option. Defaults to null.

like image 126
Bastian Hofmann Avatar answered Nov 20 '22 11:11

Bastian Hofmann