If I understand Thomas correctly, the button is not a form submitting button. It's outside the form and is handled on a request after the form is submitted.
Thomas, I think if you want to avoid resubmitting the form then you'll need to set your own "formSubmittedSuccessfully" state in Form#onSubmit. Form doesn't remember what happened on previous requests; it either updates models on success or creates error messages on failure. On Wed, Mar 14, 2012 at 2:00 PM, Igor Vaynberg <[email protected]>wrote: > if the form is invalid your button's onsubmit() wont get fired... > > -igor > > On Wed, Mar 14, 2012 at 1:53 PM, Thomas Götz <[email protected]> wrote: > > Hi! > > > > I have the following situation: > > > > I have a form containing several FormComponents and Validators, > submitted via Ajax. Then I have an AjaxButton on the same page (outside the > form) which triggers some backend logic. But it should only do so if the > mentioned form had no validation errors during the last submit. How should > I check that? Form.hasError() only checks for error messages, which always > returns 'false' as the error messages already have been rendered in one of > the preceding requests. > > > > Is it a good idea to set a flag in the Form (boolean isValid) upon > onSubmit/onError and check for that flag or is there some already provided > Wicket mechanic I could use? > > > > Cheers, > > -Tom > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [email protected] > > For additional commands, e-mail: [email protected] > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >
