Advancing form when radio button selected

By: Brad Sperr | Asked: 05/21/2023
ForumsCategory: Code HelpAdvancing form when radio button selected
Brad Sperr asked 11 months ago

I have a multipage form that I'm using to direct clients to a certain page on my site depending on their selections. There is only one radio button question on each page of the form, and I'd like the client to be taken to the next page as soon as they select an answer without having to click a "next page" button. I assigned a class of "advance" to those radio buttons, and here is the code I'm working with:

jQuery(document).ready(function ($) { 
$(".advance input[type=radio]").on('change',function () {

This works great to advance to the next page, but it's causing a conflict with conditional logic somehow. There's an html field that is supposed to show up on the second page depending on a client's selection on the first page. When I run through the form the first time on page load, the field doesn't show up on the second page like it's supposed to. If reset the form and go back to the beginning, it works just fine. Can anybody think of why this would be happening or someway I can modify my code to make it work? Thanks

Rob LeVineRob LeVine replied 11 months ago

In my experience if you use your own jquery for a field you have to give up hope that FF's jquery/js code will work on that same object with the same listener. I've found that I have to remove the FF conditional logic and handle it myself.

Brad Sperr replied 11 months ago

Thanks @Rob LeVine, How do you handle conditional logic for the fields if it's not through the builder?

Rob LeVineRob LeVine replied 11 months ago

I use jQuery to hide/show the dependent field based on the value selected in the primary field.

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community