UPDATE:
Already found out what the issue was. Had to add 'multiple' => 'multiple'
to the input array from this->Form->input
. When i added that line, the input field from Cake will be replaced by Select2.
I'm using CakePHP 2.8.x in combination with the Select2 plugin in order to get multiple select boxes, like this.
Here's my issue:
I have created an input field with the CakePHP form helper:
$sizes = array('s' => 'Small', 'm' => 'Medium', 'l' => 'Large');
echo $this->Form->input('size',
array(
'options' => $sizes,
'class' => 'form-control haai'
)
);
Cake creates the id TransferSize for me, that i can use for the Select2 plugin:
<script type="text/javascript">
$(document).ready(function(){
//Select2
$("#TransferSize").select2({
placeholder: "Select your emailaddresses"
})
});
</script>
What happens when i do this, is that Select2 generates extra input fields within Cake's input field.
Is there a way to hide the input field that CakePHP produces and display the input field that the select2 plugin generates in the hidden CakePHP input field? Or is there a better solution that any of you know?
Help will be greatly appreciated ofcourse! :)