Last active
June 23, 2017 19:27
-
-
Save Shelob9/9a9697056c04e8c24104d17a47c99033 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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