• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Validating Two Fields Match

 
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to use validation to check if two fields contain the same password i.e. password and confirm password. I looked at the example on the struts site but I cant seem to get it to work. I keep getting a ValidationException error. Im using struts 1.2.4

In my validation.xml

<field property="password" depends="required,twofields">
<msg name="required" key="errors.required"/>
<msg name="twofields" key="errors.twofields"/>
<arg0 key="userForm.password"/>
<arg1 key="userForm.passwordconfirm"/>
<var>
<var-name>secondProperty</var-name>
<var-value>passwordconfirm</var-value>
</var>
</field>

In my struts-config.xml

<form-bean name="registrationDynaValidateForm"
type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="password" type="java.lang.String"/>
<form-property name="confirmpassword" type="java.lang.String"/>

In validator-rule.xml I have

<global>
<validator name="twofields"
classname="com..ValidationUtil"
method="validateTwoFields"
methodParams="java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionMessages,
javax.servlet.http.HttpServletRequest"
depends="required"
msg="errors.twofields"/>
Thank you all
[ February 11, 2005: Message edited by: john mattucci ]
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
...
[ February 11, 2005: Message edited by: Marc Peabody ]
 
Their achilles heel is the noogie! Give them noogies tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic