I have a CJuiSelectable on a form to get some selections. I managed the events and I put in a javascript array the results, How can I pass in the post response the javascript array?
Thanks
I have a CJuiSelectable on a form to get some selections. I managed the events and I put in a javascript array the results, How can I pass in the post response the javascript array?
Thanks
A slightly inelegant solution (but workable) is to have a "hidden" field in your form, that you populate on the stop event of the "Selectable" widget:
$( ".selector" ).bind( "selectablestop", function(event, ui) {
...
});
Instead of forming a javascript array, you could form a comma-separated list (e.g. 1, 2, 3, 4) and set that as the value of the "hidden" field.
Then, in your form handler, you could do something similar to:
$model->attribute_name = explode(", ", $model->attribute_name);
You then have a PHP array of the selected items to work with.
Thank you I do it, my problem was that in javascript I doesn’t put the value correctly, works fine!