Prevent browser form submission when Wicket AjaxFormValidatingBehaviour validation fails

Posted by Brian Laframboise on Stack Overflow See other posts from Stack Overflow or by Brian Laframboise
Published on 2010-04-20T22:20:26Z Indexed on 2010/04/20 22:23 UTC
Read the original article Hit count: 182

Filed under:
|

I have a Page with a Wizard component. The user can navigate the panels of the wizard by using the next and previous buttons which I have performing full (non-ajax) form submissions so that the app is back-button friendly.

When the next button is clicked, I would like to attempt ajax form validation (if javascript is enabled). I tried doing:

nextButton.add( new AjaxFormValidatingBehavior( form, "onsubmit") );

to add such validation. The behaviour works - however, when validation errors occur the browser still submits the entire form.

What is the Wicket way to prevent the browser from submitting the form in this case?

© Stack Overflow or respective owner

Related posts about wicket

Related posts about java