Thank you.

On Mon, Nov 9, 2009 at 1:50 AM, DH <ningd...@gmail.com> wrote:

> Hi
>
> Simple sample(t5.1):
>
> In tml:
> <form t:id="regForm" t:type="beaneditform" object="user"
> include="nick,firstName,lastName" add="password,retypePassword">
>    <p:password>
>        <t:label for="password"/>
>        <t:passwordfield t:id="password" validate="required">
>    </p:password>
>    <p:retypePassword>
>        <t:label for="retypePassword"/>
>        <t:passwordfield t:id="retypePassword" validate="required">
>    </p:retypePassword>
> </form>
>
> In java:
>
> @Component
> private BeanEditForm regForm;
>
> @Property
> private User user; // your user entity
>
> @Property
> private String password;
>
> @Property
> private String retypePassword;
>
> Object onValidate() {
>    if (!password.equals(retypePassword)) {
>        regForm.recordError("password and retypepassword must be == ");
>        return this; // meaning validation failed
>    }
>    return null; // validation successfully.
> }
>
> Object onSuccess() {
>    user.setPassword(encodeutil.encode(password));
>    service.save(user);
>    return successpage or other;
> }
>
> DH
> http://www.gaonline.com.cn
>
> ----- Original Message -----
> From: "Jonhy Pear"
> To: <users@tapestry.apache.org>
> Sent: Monday, November 09, 2009 9:21 AM
> Subject: Re: beaneditform question
>
>
> Sorry, I mean beaneditform, not beaneditform
>
>
> On Mon, Nov 9, 2009 at 1:05 AM, Jonhy Pear <jonhy.p...@gmail.com> wrote:
>
> >
> >
> >
> >
> > Hello all,
> >
> > This is my first message to the list. I'm new to tapestry and I'm
> > evaluating it and looking for some guidance.
> > Let's say I have a java bean with:
> >
> > String nick;
> > String firstName;
> > String lastName;
> > String hashPassword;
> >
> > I want to use beaneditform to create a new user but I want to add new
> > fields:
> >
> > password
> > retypePassword
> >
> > and validade the presence of both and their equality. You know, that
> > typical registration process.
> >
> > When user submit the new data I want to validate the equality of both
> > password and confirmPassword and set a hash based on password in the
> field
> > hashPassword in the bean.
> >
> > Does anybody have a sample code that I can use to know what is the best
> way
> > to achieve this with tapestry?
> >
> >
> > thank you
> >
> >
> >
> >
>
>
> --
> João Miguel Pereira
> http://jpereira.eu
> LinkedIn: http://www.linkedin.com/in/joaomiguelpereira
>
> joaomiguel.pere...@gmail.com
> (351) 96 275 68 58
>



-- 
João Miguel Pereira
http://jpereira.eu
LinkedIn: http://www.linkedin.com/in/joaomiguelpereira

joaomiguel.pere...@gmail.com
(351) 96 275 68 58

Reply via email to