From June 7 through June 18, we will be performing minor community maintenance. As a result, email notifications may not send during this time. We apologize for any inconveniences!
You may have noticed the url for our site changed, as we are preparing to launch our community redesign. Stay on the lookout for details coming soon, and be sure to update your bookmarks!

Validating a question on "next" button click

klubarklubar MACommunity Member, Qualtrics Brand Admin Qubie ✭

Validating a question on "next" button click

I have some custom validation that I want to execute when the next button is clicked. If the validation passes, I want to go on to the next question, if the validation fails I want to display an error and prevent the "next" action.

I tried

jQuery.on("click keydown submit", function(){

var goodToGo = myvalidation();

return goodToGo;

});


Returning false if to prevent event bubbling, but this did not work.

Other suggestions?

Tagged:

Answers

  • ahmedAahmedA IndiaCommunity Member Wizard ✭✭✭✭✭

    There are too many event listeners attached to the next button. I suggest creating a fake next button and using that for validation. If it passes, you could just send the click event to the next button.

  • klubarklubar MACommunity Member, Qualtrics Brand Admin Qubie ✭

    good idea... what I ended up doing was disabling the next button thru the api, attaching my event handlers and if passes validation reenable the next button and then fire it thru the api.

Sign In to Comment