You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Jason Cox <ja...@yahoo.com> on 2003/10/29 01:04:55 UTC

Using ValidationConstraint

Hello,

I'm a newbie to Tapestry and I am using it as the
framework for an Intranet web portal I'm building.

One of the applications is for database access using
the user's login and password to construct the
Connection. There is a confirm password field (for
instances where they want to change their password)
that needs to match the password they enter.

I have been looking over the validation in Tapestry
and I think I need to use a ValidationConstraint to
somehow compare the fields and see if they contain
identical text. The problem is, I can't figure out how
I'm supposed to do it.

__________________________________
Do you Yahoo!?
Exclusive Video Premiere - Britney Spears
http://launch.yahoo.com/promos/britneyspears/

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


Re: Using ValidationConstraint

Posted by Jason Cox <ja...@yahoo.com>.
Seems like a good idea. I'll try it when I get to the
office.

I'll give it a shot, but I won't be able to give any
feedback since I can't post to this list during work
hours. The answer seems simple enough. I can probably
apply something similar to check for alphanumerics as
well.

Thanks

--- Paul Ferraro <pm...@columbia.edu> wrote:
> I would simply perform this logic in your listener
> method for this form:
> 
> public void login(IRequestCycle requestCycle)
> {
>     try
>     {
>         if
>
(!this.getPassword().equals(this.getConfirmPassword()))
>         {
>             // You can alternatively contruct an
> error message from a 
> ResourceBundle
>             throw new ValidatorException("Password
> and confirmation 
> password do not match."); 
>         }
> 
>         // Any other complex validation logic
> 
>         // Remainder of login logic
>     }
>     catch (ValidatorException e)
>     {
>         IValidationDelegate delegate =
> (IValidationDelegate) 
> super.getBeans().getBean("validationDelegate");
>         delegate.record(e);
>     }
> }
> 
> Paul Ferraro
> 


__________________________________
Do you Yahoo!?
Exclusive Video Premiere - Britney Spears
http://launch.yahoo.com/promos/britneyspears/

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


Re: Using ValidationConstraint

Posted by Paul Ferraro <pm...@columbia.edu>.
I would simply perform this logic in your listener method for this form:

public void login(IRequestCycle requestCycle)
{
    try
    {
        if (!this.getPassword().equals(this.getConfirmPassword()))
        {
            // You can alternatively contruct an error message from a 
ResourceBundle
            throw new ValidatorException("Password and confirmation 
password do not match."); 
        }

        // Any other complex validation logic

        // Remainder of login logic
    }
    catch (ValidatorException e)
    {
        IValidationDelegate delegate = (IValidationDelegate) 
super.getBeans().getBean("validationDelegate");
        delegate.record(e);
    }
}

Paul Ferraro

Jason Cox wrote:

>Hello,
>
>I'm a newbie to Tapestry and I am using it as the
>framework for an Intranet web portal I'm building.
>
>One of the applications is for database access using
>the user's login and password to construct the
>Connection. There is a confirm password field (for
>instances where they want to change their password)
>that needs to match the password they enter.
>
>I have been looking over the validation in Tapestry
>and I think I need to use a ValidationConstraint to
>somehow compare the fields and see if they contain
>identical text. The problem is, I can't figure out how
>I'm supposed to do it.
>
>__________________________________
>Do you Yahoo!?
>Exclusive Video Premiere - Britney Spears
>http://launch.yahoo.com/promos/britneyspears/
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>  
>



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