Exactly! My bad I mentioned AjaxButton. It should read 
'AjaxFormComponentUpdatingBehavior' on a DropDownChoice, was trying to 
generalize the problem for explaining, but 'AjaxButton' was a bad example …

Wouldn't it be convenient if a Form (or FormComponent) whould remembered their 
'valid' state so you could check for it in later (e.g. Ajax) requests?

   -Tom


Dan Retzlaff wrote:

> 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 <igor.vaynb...@gmail.com>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 <t...@decoded.de> 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: users-unsubscr...@wicket.apache.org
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>> 
>> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to