Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

bootstrap-select.js & Laravel Form Facade -- no select "value"

When using bootstrap-select.js in combination with the Laravel Form facade, no value is transmitted. dd() says null

{!! Form::select('user', $users, null, array('class' => 'selectpicker show-tick', 'data-live-search' => 'true', 'id' => 'user_select')) !!}

However when using the form facade without bootstrap-select like this:

{!! Form::select('user', $users, null) !!}

it works.

dd() says 1

like image 526
xTheWolf Avatar asked Sep 27 '16 07:09

xTheWolf


People also ask

What is the use of bootstrap select?

Bootstrap Select is a form control that shows a collapsable list of different values that can be selected. This can be used for displaying forms or menus to the user.

How do I select a dropdown in bootstrap?

To open the dropdown menu, use a button or a link with a class of . dropdown-toggle and the data-toggle="dropdown" attribute. The . caret class creates a caret arrow icon (), which indicates that the button is a dropdown.

How does Bootstrap CDN work?

A CDN is a tool that shortens the path taken by information between the user and the servers. Bootstrap websites hosted locally make use of a single server, which can slow down information transfer. CDNs comprise a network of servers located in different locations around the world.


1 Answers

When using bootstrap select, You should fetch the input like:

Input::get('id_of_your_input');

and when not using bootstrap select you should do it like this:

Input::get('name_of_your_input');

Coz bootstrap select creates another input to be sent with a new name (extracted from the original Input's Id) :)

Update You can use dd(Input::all()) to see all the inputs sent to your controller with their names.

like image 114
hamedmehryar Avatar answered Oct 30 '22 00:10

hamedmehryar