-
Notifications
You must be signed in to change notification settings - Fork 117
Description
I see a strange behaviour when trying to set the query_parameters of a Select2-form field. I have set query_parameters to ['var' => ''] in my form and it shows in the source-code of my page alright.
I now need to fill "var" with a value from another form-element dynamically, but the change is ignored and the value not sent to my remote_route. This strangely only happens when the change of the query_parameters are done in the onchange-event of the other field.
What works:
$('#my_element').data('query-parameters', {'var': 'value'});
Now I receive "value" in "var" in my remote_route and can process it.
What does NOT work:
$('#another_element').change(function () {
$('#my_element').data('query-parameters', {'var': 'value'});
}
"var" is just empty in my remote_route in this case.
I have checked the contents of "var" using console.log($('#my_element').data('query-parameters')); before and after setting it and the change is done in both cases (!), only when setting it in the onchange-event, it is not transmitted to the remote_route.