You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Entropy <bl...@gmail.com> on 2017/03/27 17:28:02 UTC

AjaxButton submits despite form validation failure?

A co-worker is having an issue that I am confused by.  He has an AjaxButton
submitting a form that (among other things) hides on WebMarkupContainer and
shows another.  But the form goes through a custom IFormValidator that
compares a few fields.

When he violates the error, we can see the code invoke the error() method on
the validator.  Yet the onSubmit() fires anyway.  He swears that it didn't
before he recently redid the page in accordance with requirements changes. 
The main thrust of the changes is that it used to be that both
WebMarkupContainers were visible the entire time.

Also, when the code get to onSubmit, he checks the message list, and it
shows as empty.  He didn't turn defaultFormProcessing off, and I'm not even
sure what to look for at this point.  I'm kind of hoping this is some common
pitfall that someone will recognize instantly.

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxButton-submits-despite-form-validation-failure-tp4677463.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: AjaxButton submits despite form validation failure?

Posted by Entropy <bl...@gmail.com>.
Awaiting confirmation from my co-worker that it worked, but we think we
figured it out.  He was adding the error message to the page level, above
the form.  Once he added the message to the form instead, the onSubmit does
not fire.  We saw the bit in the javadoc suggesting that we use
AbstractFormValidator and he is going that way.  

The only odd part is that it seems like we've done this before and not had
this problem.  But we haven't gone looking, so can't be sure.

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxButton-submits-despite-form-validation-failure-tp4677463p4677472.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: AjaxButton submits despite form validation failure?

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

If you can reproduce this in a quickstart app with 6.26.0/7.6.0/8.0.0-M4
then please create a ticket in JIRA and attach it!
Thank you!

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Mon, Mar 27, 2017 at 7:28 PM, Entropy <bl...@gmail.com> wrote:

> A co-worker is having an issue that I am confused by.  He has an AjaxButton
> submitting a form that (among other things) hides on WebMarkupContainer and
> shows another.  But the form goes through a custom IFormValidator that
> compares a few fields.
>
> When he violates the error, we can see the code invoke the error() method
> on
> the validator.  Yet the onSubmit() fires anyway.  He swears that it didn't
> before he recently redid the page in accordance with requirements changes.
> The main thrust of the changes is that it used to be that both
> WebMarkupContainers were visible the entire time.
>
> Also, when the code get to onSubmit, he checks the message list, and it
> shows as empty.  He didn't turn defaultFormProcessing off, and I'm not even
> sure what to look for at this point.  I'm kind of hoping this is some
> common
> pitfall that someone will recognize instantly.
>
> --
> View this message in context: http://apache-wicket.1842946.
> n4.nabble.com/AjaxButton-submits-despite-form-
> validation-failure-tp4677463.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>