Oups sorry, I haven't seen something in your previous mail,
It didn't work for the following reason:
the validators binding only accept a collection of Validators that are new to tap4. Thus you can only use the validators prefix (validators="validators:required, pattern=myPattern") etc... The approach you were taking is only available for ValidField (which was for tap3, and is still available for backward compatibility). As from tap4, you souldn't be using ValidField and Validator, But the new validation mechanism TextField validators="validators:required, min=0". With this new system every field is valid-able now. If you want to provide a validator configuration in the page spec (.page) you can do the following:

<bean name="emailValidator"
class="org.apache.tapestry.form.validator.Pattern"> <-- New type of validators as of Tap4
<set name="pattern" value="[A-z]+">
</bean>

and the use
<binding name="validators" value="validators:required, $emailValidator"/> <-- Look at the dollar sign


Numa


Le 26 févr. 07 à 11:26, wong wayne a écrit :

Thanks for your reply. Sorry to tell you that the
method suggested seems not work, same error message
resulted. Finally solved by using validators but I
still willing to know what’s the root cause and the
expression posted previous cannot apply to validators.
I need to changes as follows, any thought? Thanks.

component id="_textField_email" type="TextField">
  binding name="value" value="ognl:email"/>
  binding name="validators"
value="validators:[EMAIL PROTECTED]"/>
  binding name="displayName"
value="message:label_email"/>              
/component>

One more thing, is it possible to customize the error
message by our own when using validators? Thanks in
advaned

regards

wayne
--- Numa Schmeder <[EMAIL PROTECTED]> wrote:

Try to put literal in front of your pattern.
Thus :

value="literal:[EMAIL PROTECTED]

{2,6}$"

Numa

Le 26 févr. 07 à 10:02, wong wayne a écrit :

Dear all

I have some problem on Pattern Validator. Similar
code
work fine in Tapestry 3 but have problem on
Tapestry
4. Keep saying that "Error initializing property
patternString of bean 'emailValidator'" and I
cannot
figure out what's the problem.

Coding as below

bean name="emailValidator"
class="org.apache.tapestry.valid.PatternValidator"
lifecycle="page">
  set name="patternString"


value="[EMAIL PROTECTED],6}$"/>

  set name="patternNotMatchedMessage"
value="invalid-email-format"/>
  set name="requiredMessage"
value="field-required"/>

/bean>

component id="_textField_email" type="TextField">
  binding name="value" value="email"/>
  binding name="validators"
value="beans.emailValidator"/>
  binding name="displayName"
value="literal:label_email"/>              
/component>

Any hints would be appreciated. One more question
on
i18n, does the error message support different
languages? Thanks a lot.

regards

wayne





______________________________________________________________________

______________
Get your own web address.
Have a HUGE year through Yahoo! Small Business.
http://smallbusiness.yahoo.com/domains/?p=BESTDEAL



---------------------------------------------------------------------
To unsubscribe, e-mail:
[EMAIL PROTECTED]
For additional commands, e-mail:
[EMAIL PROTECTED]


--
This message has been 'sanitized'.  This means
that potentially
dangerous content has been rewritten or removed.
The following
log describes which actions were taken.

Sanitizer (start="1172481891"):
  Split unusually long Date: header.
  SanitizeFile (filename="unnamed.txt",
mimetype="text/plain"):
    Match (names="unnamed.txt", rule="2"):
      Enforced policy: accept

  Total modifications so far: 1


Anomy 0.0.0 : Sanitizer.pm
$Id: Sanitizer.pm,v 1.90 2005/01/04 20:30:13 bre
Exp $





---------------------------------------------------------------------
To unsubscribe, e-mail:
[EMAIL PROTECTED]
For additional commands, e-mail:
[EMAIL PROTECTED]






______________________________________________________________________ ______________
We won't tell. Get more on shows you hate to love
(and love to hate): Yahoo! TV's Guilty Pleasures list.
http://tv.yahoo.com/collections/265

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--
This message has been 'sanitized'.  This means that potentially
dangerous content has been rewritten or removed.  The following
log describes which actions were taken.

Sanitizer (start="1172486894"):
  Split unusually long Date: header.
  SanitizeFile (filename="unnamed.txt", mimetype="text/plain"):
    Match (names="unnamed.txt", rule="2"):
      Enforced policy: accept

  Total modifications so far: 1


Anomy 0.0.0 : Sanitizer.pm
$Id: Sanitizer.pm,v 1.90 2005/01/04 20:30:13 bre Exp $




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to