Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
jQuery( document ).ready( function( $ ) {
//find highest page
var highest_page = 1;
//IMPORTANT: Change form ID to match your form
$( '.CF594939554ca46 .caldera-form-page' ).each( function () {
highest_page = $(this).data('formpage');
});
/** When radio field is selected go to next page */
//IMPORTANT: Change form ID to match your form
$('.CF594939554ca46 input:radio').on('change', function () {
var $this = $(this);
var $form = $(this).closest('form.caldera_forms_form'),
current_page = $form.find('.caldera-form-page:visible').data('formpage');
//check if we're on the last page
if ( highest_page == current_page ) {
//find and click submit
$form.find( 'input[type="submit"]' ).trigger( 'click') ;
}else{
//find and click next page button
$form.find('[data-formpage="' + current_page + '"]').find('.cf-page-btn-next').trigger('click');
}
});
/** Hide next page buttons and submit buttons*/
//IMPORTANT: Change form ID to match your form
$('.CF594939554ca46').find('.cf-page-btn-next, input[type="submit"]').hide().attr('aria-hidden', true);
});
jQuery( document ).ready( function( $ ) {
/** When radio field is selected go to next page */
//IMPORTANT: Change form ID to match your form
$( '.CF594939554ca46 input:radio' ).on( 'change', function () {
var $this = $(this );
var $form = $( this ).closest('form.caldera_forms_form'),
current_page = $form.find('.caldera-form-page:visible').data('formpage');
$form.find( '[data-formpage="' + current_page + '"]').find( '.cf-page-btn-next' ).trigger( 'click' );
});
/** Hide next page buttons */
//IMPORTANT: Change form ID to match your form
$( '.CF594939554ca46' ).find( '.cf-page-btn-next' ).hide().attr( 'aria-hidden', true );
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.