Thank you Thomas for the prompt response and a nice example.
Does anyone know why there are 2 types of BaseValidators?
org.apache.tapestry.form.validator.BaseValidator
org.apache.tapestry.valid.BaseValidator
Took me an hour figure out why I get ClassCastExceptions thrown ;)
I noticed some validators were created by Howard since 4.0 and others
were created by contributors from previous versions of tapestry. Are we
trying to phase out org.apache.tapestry.valid package?
-Dennis
[EMAIL PROTECTED] wrote:
For a text field where we only wanted a certain set of ascii characters
allowed, one of our Tapestry guys played around with the following
component & validator pair...
<component id="filedByField" type="TextField">
<binding name="value" value="document.filedBy"/>
<binding name="validators" value="bean:asciiValidatorReq"/>
<binding name="displayName" value="literal:Filed By"/>
</component>
<bean name="asciiValidator"
class="gov.usitc.edis.validators.RegExValidator">
<set name="pattern"> '^[\'\"a-zA-Z0-9\\s|.\\/!# & <
>,?\\[\\]{}()-_*;:[EMAIL PROTECTED]'</set>
<set name="errorMessage"
value="getMessageProperty(@[EMAIL PROTECTED]
ON_ASCII_ERROR)"/>
<set name="requiredField" value="false"/>
</bean>
-----Original Message-----
From: news [mailto:[EMAIL PROTECTED] On Behalf Of Dennis Sinelnikov
Sent: Tuesday, November 07, 2006 10:06 AM
To: users@tapestry.apache.org
Subject: pattern validator
I'm trying to use the pattern validator in my .page to do some input
validation. I was thinking I could use regular expressions just like in
Perl. Similar to the following:
<binding name="validators"
value="validators:required,pattern=[a-zA-Z]+"/>
Tried googling, no luck. Could someone please provide a simple example?
Thanks guys,
Dennis
---------------------------------------------------------------------
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]