• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

why no errors shown for password validation in struts 1.2.4

 
john mattucci
Ranch Hand
Posts: 331
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the following in my validation.xml file

<field property="passwordconfirm"
depends="required">
<arg0 key="registration.passwordconfirm"/>
</field>

In my jsp I have the following

Password Confirm<html assword property="passwordconfirm" size="10" />
<html:errors property="passwordconfirm"/>

In my ApplicationResources.properties file I have the following
errors.required={0} is required.

registration.firstname = First name
registration.passwordconfim= Password

Other text fields work fine i.e. the errors are shown
 
Klaus Jesper
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try using this in your jsp:

<html:messages property="passwordconfirm" message="false" id="pwConfirm" >
<bean:write name="pwConfirm"/>
</html:messages>

This article could help:
http://www.oracle.com/technology/oramag/oracle/04-jan/o14dev_struts.html

Klaus
 
john mattucci
Ranch Hand
Posts: 331
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
that does not work either.

I have over a dozen fields and most of them work. However a few for life of me
I cant get to work i.e. password, cofirm password, country

In my jsp I have

Country <html:text property="country" size="10" />
<html:errors property="country"/>

In my validation.xml I have

<field
property="country
depends="required">
<arg key="registration.country"/>
</field>

In my ApplicationResources.properties

registration.country = Country

In my struts-config I have

<form-beans>
<form-bean name="registrationDynaValidateForm"
type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="firstname" type="java.lang.String"/>
<form-property name="lastname" type="java.lang.String"/>
<form-property name="phone" type="java.lang.String"/>
<form-property name="address1" type="java.lang.String"/>
<form-property name="city" type="java.lang.String"/>
<form-property name="province" type="java.lang.String"/>
<form-property name="postalcode" type="java.lang.String"/>
<form-property name="country" type="java.lang.String"/>
.....


Like I said for others I have done the same thing and they work. Has anybody else had this problem?
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Make sure it is mapped to the form correctly in the validation.xml. Do you have fields in the same form that work or are the ones that work locately elsewhere?
 
john mattucci
Ranch Hand
Posts: 331
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are about 15 fields in the same form and a little over half work and the others for some reason dont. I cant figure this out. This is part of the validation.xml

<form-validation>
<formset>
<form name="registrationDynaValidateForm">

<field
property="postalcode"
depends="required">
<arg0 key="registration.postalcode"/>
</field>
<field
property="country"
depends="required">
<arg key="registration.country"/>
</field>
<field
property="deviceid"
depends="required,mask">
<arg0 key="registration.deviceid"/>
<var>
<var-name>mask</var-name>
<var-value>^[0-9a-zA-Z]*$</var-value>
</var>
</field>
<field
property="creditcardtype"
depends="required">
<arg0 key="registration.creditcardtype"/>
</field>
<field
property="ccnumber"
depends="creditCard">
<arg0 key="registration.ccnumber"/>
</field>
<field property="expirymonth" depends="validwhen">
<arg0 key="registration.expirymonth"/>
<var>
<var-name>test</var-name>
<var-value>((ccnumber == null) or (*this* != null))</var-value>
</var>
</field>
<field property="expiryyear" depends="validwhen">
<arg0 key="registration.expiryyear"/>
<var>
<var-name>test</var-name>
<var-value>((ccnumber == null) or (*this* != null))</var-value>
</var>
</field>
<field property="securitynumber" depends="requireif">
<arg0 key="registration.securitynumber"/>
<var>
<var-name>field[0]</var-name>
<var-value>creditcardtype</var-value>
</var>
<var>
<var-name>fieldTest[0]</var-name>
<var-value>EQUAL</var-value>
</var>
<var>
<var-name>fieldValue[0]</var-name>
<var-value>Visa</var-value>
</var>
</field>

<field property="passwordconfirm"
depends="required">
<arg0 key="registration.passwordconfirm"/>
</field>
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I cant get to work i.e. password, cofirm password, country

password is not in your validation.xml
passwordconfirm might be a case-sensitive issue. Check the "C/c"
country has "arg" and not "arg0"

Hope at least one of these fixes something.
[ January 21, 2005: Message edited by: Marc Peabody ]
 
john mattucci
Ranch Hand
Posts: 331
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I didnt post my entire validation.xml that is why you dont see password. The cases are right for all of them I have checked them many times. I changed country arg0, however the error for country does not come through......
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which ones work?
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic