• 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

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

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi vamsi,
Me too having the same kind of problem,
If you get any solutions please post here.

thanks
 
vamsi mummadi
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 425
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You got the name attribute of arg1 and arg2 wrong. Change it to "intRange" and try.
 
vamsi mummadi
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 425
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try with these changes


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

 
vamsi mummadi
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Purushothaman
thank you very much. that started working.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic