You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Luke Majewski <lu...@verizon.net> on 2003/03/30 05:29:01 UTC

intake validate

Hi,

so Intake is almost fully working except I have one minor concern - I have an "int" type in my intake.xml, and it gets automatically validated by intake, so if I insert "abc" into my integer field it gives me the message "Entry was not a valid integer" - now I also have a mask rule (which might not be working correctly, so maybe that's it) that is supposed to check for validity of my field... the mask is:

value="^([0-9]*)$"   ---> I just want it to be an integer

now I want my mask rule message to have precedence over the automatic validation intake does, because I have a number of integer fields on my form and the message "Entry is not a valid integer" is not very informative... now I can do something boring like check to see if my message is "Entry is not a valid integer" and then just change the message myself per each invalid field, but I would prefer that the mask simply takes precedence over the auto stuff (otherwise why write the mask rule anyways?). Anybody seen this before?

Thanks a lot!

Luke

RE: intake validate

Posted by Chris K Chew <ch...@fenetics.com>.
> From: "Luke Majewski"
>
> Wow that works perfectly
>
> From: "Thomas Vandahl"
> >
> > There is another rule type that you can use for this. It is part of any
> > NumberValidator derived class. Try adding something like
> >
> > <rule name="notANumberMessage">Bitte nur numerische Daten
> > eingeben.</rule>

No kidding -- thanks Thomas!  I've been around for a while and missed it
completely.

I created a patch for the intake howto and submitted it to scarab in the
Turbine2--Documentation module.  Hopefully the fellas with commit
permissions will notice and apply it.

http://scarab.werken.com/scarab/issues/id/TRQD20

Thanks,

Chris



---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


Re: intake validate

Posted by Luke Majewski <lu...@verizon.net>.
Wow that works perfectly - that will teach me to take a quick look at the
javadoc before asking  stuff like that again.  For the purpose of the rest
of the mailing list, this rule _does_ take precedence over the default
"Entry was not a valid integer" rule - makes me think my mask might have
been wrong?  Anyways, thanks a lot,

Luke

----- Original Message -----
From: "Thomas Vandahl" <th...@hm-informatik.de>
To: "'Turbine Users List'" <tu...@jakarta.apache.org>
Sent: Sunday, March 30, 2003 9:10 AM
Subject: RE: intake validate


> Hi Luke,
>
> > -----Original Message-----
> > From: Luke Majewski [mailto:luke.majewski@verizon.net]
> > Sent: Sunday, March 30, 2003 5:29 AM
>
> > now I want my mask rule message to have precedence over the
> > automatic validation intake does, because I have a number of
> > integer fields on my form and the message "Entry is not a
> > valid integer" is not very informative... now I can do
> > something boring like check to see if my message is "Entry is
> > not a valid integer" and then just change the message myself
> > per each invalid field, but I would prefer that the mask
> > simply takes precedence over the auto stuff (otherwise why
> > write the mask rule anyways?). Anybody seen this before?
>
> There is another rule type that you can use for this. It is part of any
> NumberValidator derived class. Try adding something like
>
> <rule name="notANumberMessage">Bitte nur numerische Daten
> eingeben.</rule>
>
> to your int field and look if it works. It does for me.
>
> Bye, Thomas.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-user-help@jakarta.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


RE: intake validate

Posted by Thomas Vandahl <th...@hm-informatik.de>.
Hi Luke,

> -----Original Message-----
> From: Luke Majewski [mailto:luke.majewski@verizon.net]
> Sent: Sunday, March 30, 2003 5:29 AM

> now I want my mask rule message to have precedence over the
> automatic validation intake does, because I have a number of
> integer fields on my form and the message "Entry is not a
> valid integer" is not very informative... now I can do
> something boring like check to see if my message is "Entry is
> not a valid integer" and then just change the message myself
> per each invalid field, but I would prefer that the mask
> simply takes precedence over the auto stuff (otherwise why
> write the mask rule anyways?). Anybody seen this before?

There is another rule type that you can use for this. It is part of any
NumberValidator derived class. Try adding something like

<rule name="notANumberMessage">Bitte nur numerische Daten
eingeben.</rule>

to your int field and look if it works. It does for me.

Bye, Thomas.


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


Re: intake validate

Posted by Luke Majewski <lu...@verizon.net>.
thank you, sound like exactly what I needed - I thought about putting the
error next to the invalid field and I might still do that - but I think the
way that my form is setup I would prefer it at the top...  Thanks again
Chris!

Luke

----- Original Message -----
From: "Chris K Chew" <ch...@fenetics.com>
To: "Turbine Users List" <tu...@jakarta.apache.org>
Sent: Saturday, March 29, 2003 10:45 PM
Subject: RE: intake validate


> > From: Luke Majewski
> > ... now I can do something boring
> > like check to see if my message is "Entry is not a valid integer"
> > and then just change the message myself per each invalid field,
> > but I would prefer that the mask simply takes precedence over the
> > auto stuff (otherwise why write the mask rule anyways?). Anybody
> > seen this before?
>
> It sounds like you are displaying the errors at the top of the form?  I
> always put the error message in red directly above the field that is
> invalid.  This way the message is more helpful since it is near the
invalid
> field instead of at the top of the page.
>
> Take a look at the Validator sources in o.a.t.services.intake.validator.*,
> especially the IntegerValidator.doAssertValidity() method -- It doesn't
even
> check the mask.
>
(http://jakarta.apache.org/turbine/turbine-2.2.1/xref/org/apache/turbine/ser
> vices/intake/validator/IntegerValidator.html)
>
> If you don't want to go with my suggestion, try writing your own Validator
> using DefaultValidator.doAssertValidity() and
> IntegerValidator.doAssertValidity() as templates.  Specify your
home-brewed
> validator class in the <field> "validator" attribute in intake.xml.
>
> Good luck,
>
> Chris
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-user-help@jakarta.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


RE: intake validate

Posted by Chris K Chew <ch...@fenetics.com>.
> From: Luke Majewski
> ... now I can do something boring
> like check to see if my message is "Entry is not a valid integer"
> and then just change the message myself per each invalid field,
> but I would prefer that the mask simply takes precedence over the
> auto stuff (otherwise why write the mask rule anyways?). Anybody
> seen this before?

It sounds like you are displaying the errors at the top of the form?  I
always put the error message in red directly above the field that is
invalid.  This way the message is more helpful since it is near the invalid
field instead of at the top of the page.

Take a look at the Validator sources in o.a.t.services.intake.validator.*,
especially the IntegerValidator.doAssertValidity() method -- It doesn't even
check the mask.
(http://jakarta.apache.org/turbine/turbine-2.2.1/xref/org/apache/turbine/ser
vices/intake/validator/IntegerValidator.html)

If you don't want to go with my suggestion, try writing your own Validator
using DefaultValidator.doAssertValidity() and
IntegerValidator.doAssertValidity() as templates.  Specify your home-brewed
validator class in the <field> "validator" attribute in intake.xml.

Good luck,

Chris


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org