You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Brian Mulholland <bl...@gmail.com> on 2010/06/15 23:57:57 UTC

Validation

I have two validations on a textbox.  One is extended from the
EmailValidation class that comes with wicket and works fine.  The
other is an extension of AbstractValidator.  That one never gets
called.  It never gets to the onValidate().  Why would one validator
get invoked and function perfectly while the other got ignored?  Both
were added to the component.

Brian Mulholland

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


Re: Validation

Posted by Jeremy Thomerson <je...@wickettraining.com>.
On Tue, Jun 15, 2010 at 5:24 PM, Brian Mulholland <bl...@gmail.com>wrote:

> The two are added to the same component, but have no direct
> relationship to each other.  It IS true that the non-working one is
> added 2nd.  However in the test where I am trying to get control to
> the 2nd one, I typed input that did not evoke a message from the first
> validator.
>
> But could you elaborate on that point?  Do you mean that the order in
> which I add validators dictates the order in which they execute and
> that when a validator fails, others are not executed?  Does that rule
> only apply within the component?  And do form validators run if a
> field validator fails?
>
> I've been looking around for details like this, and all I see are
> highly simplistic examples about required checks.  I never seem to
> find an in depth discussion about when validators fire, how they
> interact and so forth.  Where is this info discussed?
>
> Brian Mulholland
>
>
>
>
> On Tue, Jun 15, 2010 at 6:12 PM, Jeremy Thomerson
> <je...@wickettraining.com> wrote:
> > On Tue, Jun 15, 2010 at 4:57 PM, Brian Mulholland <
> blmulholland@gmail.com>wrote:
> >
> >> I have two validations on a textbox.  One is extended from the
> >> EmailValidation class that comes with wicket and works fine.  The
> >> other is an extension of AbstractValidator.  That one never gets
> >> called.  It never gets to the onValidate().  Why would one validator
> >> get invoked and function perfectly while the other got ignored?  Both
> >> were added to the component.
> >>
> >> Brian Mulholland
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >>
> > IIRC, a second validator will not get called if the first fails.  Does
> the
> > second one get called when the first succeeds?
> >
> > --
> > Jeremy Thomerson
> > http://www.wickettraining.com
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
Validators are added sequentially and run sequentially.  When the first
fails, the other does not get called.  A simple test will prove this for
you:

add(new FeedbackPanel("feedback")); Form form = new Form("form"); final
TextField tf = new TextField("text", new Model<String>(""));
tf.add(StringValidator.minimumLength(4)); tf.add(new
PatternValidator("^T.*")); form.add(tf); add(form);

<div wicket:id="feedback"></div> <form wicket:id="form"> <input type="text"
wicket:id="text" /> <input type="submit" /> </form>


-- 
Jeremy Thomerson
http://www.wickettraining.com

Re: Validation

Posted by Brian Mulholland <bl...@gmail.com>.
The two are added to the same component, but have no direct
relationship to each other.  It IS true that the non-working one is
added 2nd.  However in the test where I am trying to get control to
the 2nd one, I typed input that did not evoke a message from the first
validator.

But could you elaborate on that point?  Do you mean that the order in
which I add validators dictates the order in which they execute and
that when a validator fails, others are not executed?  Does that rule
only apply within the component?  And do form validators run if a
field validator fails?

I've been looking around for details like this, and all I see are
highly simplistic examples about required checks.  I never seem to
find an in depth discussion about when validators fire, how they
interact and so forth.  Where is this info discussed?

Brian Mulholland




On Tue, Jun 15, 2010 at 6:12 PM, Jeremy Thomerson
<je...@wickettraining.com> wrote:
> On Tue, Jun 15, 2010 at 4:57 PM, Brian Mulholland <bl...@gmail.com>wrote:
>
>> I have two validations on a textbox.  One is extended from the
>> EmailValidation class that comes with wicket and works fine.  The
>> other is an extension of AbstractValidator.  That one never gets
>> called.  It never gets to the onValidate().  Why would one validator
>> get invoked and function perfectly while the other got ignored?  Both
>> were added to the component.
>>
>> Brian Mulholland
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
> IIRC, a second validator will not get called if the first fails.  Does the
> second one get called when the first succeeds?
>
> --
> Jeremy Thomerson
> http://www.wickettraining.com
>

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


Re: Validation

Posted by Jeremy Thomerson <je...@wickettraining.com>.
On Tue, Jun 15, 2010 at 4:57 PM, Brian Mulholland <bl...@gmail.com>wrote:

> I have two validations on a textbox.  One is extended from the
> EmailValidation class that comes with wicket and works fine.  The
> other is an extension of AbstractValidator.  That one never gets
> called.  It never gets to the onValidate().  Why would one validator
> get invoked and function perfectly while the other got ignored?  Both
> were added to the component.
>
> Brian Mulholland
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
IIRC, a second validator will not get called if the first fails.  Does the
second one get called when the first succeeds?

-- 
Jeremy Thomerson
http://www.wickettraining.com