You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Rauf Khan <mk...@gmail.com> on 2006/08/11 11:29:57 UTC

To validate password & confirmpassword fields

Hi,

   I trying to validate the fields using Validator Framework at client side,
Iam not able to validate the password & confirmpassword fields inorder to
show an alert msg if password & confirmpassword fields are not same. Can i
know how to handle this case.

<html:password property="password"/>
<html:password property="confirmpassword"/>

Thanks in advance.

Regards
Khan

Re: To validate password & confirmpassword fields

Posted by Li <am...@gmail.com>.
sorry, my mistakes,

er you can create validate method and compare them there. then in your
struts-config.xml, make sure the action that control the form
submission has input page. in order to avoid validation check at first
time. you can define an action that only forward to your password
input page. the the action that handles the form submission will be
different from this actiona which is bundle with your action form.

:P

On 8/11/06, Rauf Khan <mk...@gmail.com> wrote:
> Hi,
>
>     Iam doing validation for registration page where password &
> confirmpassword fields should have the same password if not an alert msg
> through javascript(validator framework) should be shown. I have validated
> rest of the fields through validator framework only.
>
> Khan
>
>
> On 8/11/06, Li <am...@gmail.com> wrote:
> >
> > seems you are using your own authentication module, one thing you can
> > do it using javascript, or you can use form authentication, and define
> > login page and login error page, so if your userid or password is not
> > valid, login error page will showed up.
> >
> > Wish it helps
> >
> > Regards
> >
> > On 8/11/06, Rauf Khan <mk...@gmail.com> wrote:
> > > Hi,
> > >
> > >    I trying to validate the fields using Validator Framework at client
> > side,
> > > Iam not able to validate the password & confirmpassword fields inorder
> > to
> > > show an alert msg if password & confirmpassword fields are not same. Can
> > i
> > > know how to handle this case.
> > >
> > > <html:password property="password"/>
> > > <html:password property="confirmpassword"/>
> > >
> > > Thanks in advance.
> > >
> > > Regards
> > > Khan
> > >
> > >
> >
> >
> > --
> > When we invent time, we invent death.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
>
>


-- 
When we invent time, we invent death.

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


Re: To validate password & confirmpassword fields

Posted by Rauf Khan <mk...@gmail.com>.
Hi,

    Iam doing validation for registration page where password &
confirmpassword fields should have the same password if not an alert msg
through javascript(validator framework) should be shown. I have validated
rest of the fields through validator framework only.

Khan


On 8/11/06, Li <am...@gmail.com> wrote:
>
> seems you are using your own authentication module, one thing you can
> do it using javascript, or you can use form authentication, and define
> login page and login error page, so if your userid or password is not
> valid, login error page will showed up.
>
> Wish it helps
>
> Regards
>
> On 8/11/06, Rauf Khan <mk...@gmail.com> wrote:
> > Hi,
> >
> >    I trying to validate the fields using Validator Framework at client
> side,
> > Iam not able to validate the password & confirmpassword fields inorder
> to
> > show an alert msg if password & confirmpassword fields are not same. Can
> i
> > know how to handle this case.
> >
> > <html:password property="password"/>
> > <html:password property="confirmpassword"/>
> >
> > Thanks in advance.
> >
> > Regards
> > Khan
> >
> >
>
>
> --
> When we invent time, we invent death.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: To validate password & confirmpassword fields

Posted by Li <am...@gmail.com>.
seems you are using your own authentication module, one thing you can
do it using javascript, or you can use form authentication, and define
login page and login error page, so if your userid or password is not
valid, login error page will showed up.

Wish it helps

Regards

On 8/11/06, Rauf Khan <mk...@gmail.com> wrote:
> Hi,
>
>    I trying to validate the fields using Validator Framework at client side,
> Iam not able to validate the password & confirmpassword fields inorder to
> show an alert msg if password & confirmpassword fields are not same. Can i
> know how to handle this case.
>
> <html:password property="password"/>
> <html:password property="confirmpassword"/>
>
> Thanks in advance.
>
> Regards
> Khan
>
>


-- 
When we invent time, we invent death.

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


Re: To validate password & confirmpassword fields

Posted by Bart Busschots <ba...@so-4pt.net>.
This is a very common thing to do and should be done with the validWhen 
validation as described on the Validotor page of the Struts User Guide 
(http://struts.apache.org/1.x/userGuide/building_view.html#validator).

Below is the validation I use on a change password form as an example:

<form name="changePasswordForm">
   <field property="passwordCurrent" depends="required">
    <arg0 key="login.changePassword.currentPassword.label"/>
   </field>
   <field property="passwordNew" depends="required, minlength">
    <arg0 key="login.changePassword.newPassword.label"/>
    <arg1 name="minlength" key="${var:minlength}" resource="false"/>
    <var><var-name>minlength</var-name><var-value>6</var-value></var>
   </field>
   <field property="passwordNewVerify" depends="validwhen">
    <arg0 key="login.changePassword.newPwsNotEqual"/>
    <var>
     <var-name>test</var-name>
     <var-value>(*this* == passwordNew)</var-value>
    </var>
   </field>
  </form>

HTH,

Bart.

Rauf Khan wrote:
> Hi,
>
>   I trying to validate the fields using Validator Framework at client 
> side,
> Iam not able to validate the password & confirmpassword fields inorder to
> show an alert msg if password & confirmpassword fields are not same. 
> Can i
> know how to handle this case.
>
> <html:password property="password"/>
> <html:password property="confirmpassword"/>
>
> Thanks in advance.
>
> Regards
> Khan
>


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