The Community forums are being phased out in favor of a new Slack group.
Add your email address below to get an invitation to join the community slack group

Slack Signup
Newsletter Optin
Help Desk

Radio button to trigger next button using jQuery

Labels

This Discussion is public

Notifications

My objective is to allow progression through a multi-part form (page breaks) when the user selects a radio button, so they don't need to click 'Next'.

It's simple enough to trigger the next button from a radio button like this...

$(".frm_radio").change(function(){
$('.frm_button_submit').trigger("click");
});

This works exactly as intended. When the user selects a radio button, the 'next' button is triggered and the form progresses to the next page break. However, conditional fields don't display?!?!

Do any clever JS users know why this might be happening?

Points to note:

  • I'm using ajax on this form.
  • I've included an ajaxComplete function as well.
  • I've tested the form without ajax enabled and it behaves the same way, conditional fields do not display.
  • The site is being developed locally so I can't provide a link to the site.

Thanks.

Update

I believe it has something to do with the order that things are being executed. If I add a delay to the trigger then it works as intended. So when the radio is clicked, the trigger is firing before the radio is checked, it progresses to the next page break and any conditional fields are not visible because the radio that controls their visibility isn't checked. The strange part is that the radio has a check mark in it, but it's not checked?!? jQuery must be messing with the radio somehow?

Discussion closed.