This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Struts and the fly likes intRange validations Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "intRange validations " Watch "intRange validations " New topic

intRange validations

Padmini Nagarajan

Joined: May 26, 2005
Posts: 5
Struts validator framework provides us with and intRange validation and can be used as below. My doubt here is , is there anyway that var-value can refer to a property instead of hard coded values like 10, 20 etc.
i.e I want to validate the range against another form property .

<arg0 key="typeForm.integer.displayname"/>
alan do
Ranch Hand

Joined: Apr 14, 2005
Posts: 354
you can use the 'validwhen' rule instead of intRange IF you are using struts 1.2.x. validwhen allows you to pass in other properties. see struts user guide on the apache site for examples of 'validwhen'.

-/a<br />certified slacker...yes, my last name is 'do' - <a href="" target="_blank" rel="nofollow"></a>
Padmini Nagarajan

Joined: May 26, 2005
Posts: 5
Hi Alan,

Thanks for the reply. Tried validWhen rule and it works. But I still have a problem in displaying the error message.I am displaying a generic message like "Field XXX is not within the range,Please enter again" but now I need to display
a message like "Field XXX is not in the range ZZZ and YYY" Where ZZZ and YYY would again be dynamically generated values.
I agree. Here's the link:
subject: intRange validations
jQuery in Action, 3rd edition