I have a series of bootstrap radio buttons in a search filter system. All is working find with a series of onchange and onclick events assoicated when them.
The issues I am having is when I run a search and repopulate all the radio filters.
The bootstrap radio buttons are outputted the the same normal and checked="checked"
is added to the selected radio.
I'm then set the relevant label as active and simulate a CLICK trigger event. This runs a series of events critical to the interface.
$('input[type="radio"]:checked').parent('label').addClass('active');
//simulate click
$('input[type="radio"]:checked').parent('label').click( );
$('input[type="radio"]:checked').click( );
*Note: I have tried various combination of the click trigger
Checking the code it is a correct output. checked="checked"
is in the radio and the buttons/label is active.
However when I resubmit the form, WITHOUT CLICKING ON THE RADIO, the values for these radio buttons are not in the post. They just vanish. This ONLY happens when I run the click tigger. If I click a radio buttons THAT IS NOT SELECTED the value IS submitted in post. If I click on the already active label (already selected) radio the value is not in post. Only if I click a new value after I have run the jquery click trigger.
If I omit the click trigger the radio button values are successfully posted as expected.
When using the click trigger all attached events associated with the click trigger run fine. However when I use the clicks trigger and do not change the value, the radio just vanishes from the return $_POST.
Why is this? Am I doing something wrong? At this point in development I need the click trigger to function correctly.