File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Iam getting nulls in alert messages when using struts validator frame work Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Iam getting nulls in alert messages when using struts validator frame work" Watch "Iam getting nulls in alert messages when using struts validator frame work" New topic
Author

Iam getting nulls in alert messages when using struts validator frame work

vamsi mummadi
Greenhorn

Joined: Jul 25, 2006
Posts: 9
hi
iam getting one problem while using java script validations from validator frame work. Iam giving int range validation for one field. while giving alert message when user entered value is not in range then iam getting nulls
in that message in the case of range values.
My code is like this
my form bean is
<form-bean name="reqOneForm" type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="voucher_no" type="java.lang.String"/>
<form-property name="req_date" type="java.lang.String"/>
<form-property name="req_name" type="java.lang.String"/>
<form-property name="count" type="java.lang.Integer"/>
<form-property name="req_by" type="java.lang.Integer"/>
</form-bean>


in validation.xml

<form name="reqOneForm">
<field property="count"
depends="required,integer,intRange">
<arg0 key="reqOneForm.count"/>
<arg1 key="${var:min}"
name="min" resource="false"/>
<arg2 key="${var:max}"
name="max" resource="false"/>
<var>
<var-name>min</var-name>
<var-value>1</var-value>
</var>
<var>
<var-name>max</var-name>
<var-value>5</var-value>
</var>
</field>
</form>

Message in Resources file is

errors.range={0} is not in the range {1} through {2}.

And iam getting java script as like this


function intRange () {
this.aa = new Array("count", "No. of Items is not in the range null through null.", new Function ("varName", "this.min='1'; this.max='5'; return this[varName];"));
}

while sending that message itself it is sending null values
But range values are validating properly.

Iam getting alert message is "No. of Items is not in the range null through null."

what may be the problem iam not getting.
please give me solution for this


vamsi
Sai Priya
Greenhorn

Joined: Jul 06, 2006
Posts: 7
Hi vamsi,
Me too having the same kind of problem,
If you get any solutions please post here.

thanks
vamsi mummadi
Greenhorn

Joined: Jul 25, 2006
Posts: 9
Hi
please any one try to solve my problem. I tried so many options but nothing worked. please i need the solution very urgently.
thank you
Purushoth Thambu
Ranch Hand

Joined: May 24, 2003
Posts: 425
You got the name attribute of arg1 and arg2 wrong. Change it to "intRange" and try.
vamsi mummadi
Greenhorn

Joined: Jul 25, 2006
Posts: 9
hi purushothaman
i didnt get what you are saying. can you please send details where i have to change that intRange.
thank you
vamsi
Purushoth Thambu
Ranch Hand

Joined: May 24, 2003
Posts: 425
Try with these changes

<arg1 key="${var:min}"
name="intRange" resource="false"/>
<arg2 key="${var:max}"
name="intRange" resource="false"/>
vamsi mummadi
Greenhorn

Joined: Jul 25, 2006
Posts: 9
hi Purushothaman
thank you very much. that started working.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Iam getting nulls in alert messages when using struts validator frame work
 
Similar Threads
intrange validator message
Javascript error in range validation
intRange validations
Validation only greaterThan
'required,intRange' Validation Problems