*Finally* got this to work properly
Thanks for the hint.
Actually, it's a little different than what you suggested, but it set me off
in the right direction. After looking in the source and jwc files for the
components, it became clear.
Here's what worked (note the change from 3.0 style validation - the new
approach looks cleaner):
@Component(type="Form", bindings={"clientValidationEnabled=true"})
public abstract Form getForm();
@Component(
id="email",
type="TextField",
bindings={"value=email", "displayName=Email",
"validators=required,email"})
public abstract TextField getEmailField();
Note the following:
- No creation of validation delegate (one is created by default in 4.0 - see
Form.jwc)
- No explicit creation of validators. Just specify the classes to be
applied (I wonder what their default lifecycle is)
Lance
-----Original Message-----
From: Andrew Ofisher [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 02, 2005 2:45 PM
To: Tapestry users
Subject: Re: Tap4 Basic Form Validation without Page Specification
@Component(id="email", type="TextField",
bindings={"validators=beans.emailValidator"})
Try validators instead of validator. TextField is the replacement for
ValidField in Tap4.
On 8/2/05, Lance Arlaus <[EMAIL PROTECTED]> wrote:
> I finally got a version running using a form field of type ValidField, but
I
> get a message that it's been deprecated. Anybody know the replacement in
> Tap4?
>
>
> -----Original Message-----
> From: Lance Arlaus [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, August 02, 2005 12:46 PM
> To: Tapestry Users Mailing List
> Subject: Tap4 Basic Form Validation without Page Specification
>
> I'm trying to get basic form validation up and running without a page
> specification, if possible, but I can't seem to get it to work.
>
> Form comes up fine, but validation's a no-go :(
>
> Here's what I've got:
>
>
>
> Page:
>
> <form jwcid='[EMAIL PROTECTED]' listener="listener:formSubmit"
> delegate="beans.validationDelegate" method="get">
>
> .
>
> <td><input jwcid='email' value='email' length='30'></input></td>
>
> .
>
>
>
> Page Class:
>
>
>
> public abstract class Home extends BasePage {
>
>
>
> @Bean
>
> public abstract ValidationDelegate getValidationDelegate();
>
> @Bean(lifecycle=Lifecycle.PAGE,
> initializer="required,clientScriptingEnabled")
>
> public abstract EmailValidator getEmailValidator();
>
>
>
> @Component(id="email", type="TextField",
> bindings={"validator=beans.emailValidator"})
>
> public abstract TextField getEmailField();
>
>
>
> public abstract String getEmail();
>
> public abstract void setEmail(String email);
>
> .
>
> }
>
>
>
> Generated HTML:
>
> .
>
> <td><input type="text" name="email" value="" id="email"
> validator="[EMAIL PROTECTED]"
> length="30"/></td>
>
> .
>
>
>
> Looks like Tap is just doing a toString() and considering validator an
> informal parameter.
>
> Suggestions, anyone?
>
>
>
> ---------------------------------------------------------------------
> 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]