Click on Radio button to go to next step

[ad_1]

Hi @probillals

I hope you are doing well.

It is not possible out of the box but could you please try this code?

https://gist.github.com/patrickfreitasdev/40caa1761b482de3912c4751067d98bb

Add it as a mu-plugin https://wpmudev.com/docs/using-wordpress/installing-wordpress-plugins/#installing-mu-plugins

Then edit your radio field, switch to CSS class and use:

next-on-click

https://monosnap.com/file/76nPywaBLuKFCnIhNc9Lcu1IsR5MoO

I tested it on my lab site and the code still working well.

Let us know the result you got,
Best Regards
Patrick Freitas

Hey Patrick

The code is working just like magic. Thank you so much. However, I have shorten the code to fit it exactly what I need. I am sharing the code if anyone wants the same.

Thanks a lot again. You deserve 5*

add_action(
	'wp_footer',
	function() {

		if ( ! wp_script_is( 'forminator-front-scripts' ) ) {
			return;
		}
		?>
		<script type="text/javascript">

		

			jQuery(document).ready(function ($) {
			  $(document).on('after.load.forminator', function (e, form_id) {
			    var next_button = document.querySelector('.forminator-button-next'),
			      click_event = new CustomEvent('change_evt'),
			      clickable_elements = document.querySelectorAll(
				'.next-on-click .forminator-radio',
			      ),
			      radios = document.querySelectorAll('.next-on-click input[type="radio"]');

			    clickable_elements.forEach((clickable_element) => {
			      clickable_element.addEventListener(
				'click',
				wpmudev_clickables_event_callback,
			      );
			      clickable_element.addEventListener(
				'touchstart',
				wpmudev_clickables_event_callback,
			      );
			    });

			    function wpmudev_clickables_event_callback() {
			      radios.forEach((radio) => {
				radio.addEventListener('change', wpmudev_change_evt_callback);
			      });
			    }

			    function wpmudev_change_evt_callback(e) {
			      if (e.currentTarget.checked) {
				$('.forminator-button-next').trigger('click');
			      }
			    }
			  });
			  setTimeout(function () {
			    $('.forminator-custom-form').trigger('after.load.forminator');
			  }, 100);
			});

		</script>
		<?php
	},
	999
);

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer