aspose file tools
The moose likes Struts and the fly likes How to Validate this? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Frameworks » Struts
Reply Bookmark "How to Validate this?" Watch "How to Validate this?" New topic
Author

How to Validate this?

Dev Brazil
Greenhorn

Joined: Jan 06, 2005
Posts: 1
Hi.

I have one form that it repeats some times some fields. However the same ones have the same property, as make for validate them?

See the example:



Thanks.
[ January 06, 2005: Message edited by: Dev Brazil ]
Jason Menard
Sheriff

Joined: Nov 09, 2000
Posts: 6450
"Dev Brazil",

Welcome to JavaRanch! We don't have many rules here, but we do have a naming policy which we strictly enforce. Please re-read this policy and edit your display name in order to comply. Thanks in advance, and we look forward to seeing you around the Ranch.


Jason's Blog
Nathaniel Stoddard
Ranch Hand

Joined: May 29, 2003
Posts: 1258
Struts does allow for indexed properties. So, you could do something like:

Or something very close to ... I'd check out the Struts documentation pages on indexed, mapped, and nested properties.


Nathaniel Stodard<br />SCJP, SCJD, SCWCD, SCBCD, SCDJWS, ICAD, ICSD, ICED
s penumudi
Ranch Hand

Joined: Nov 17, 2004
Posts: 113
I guess you wanted to know how to validation a form field if there is more than one form field with same name.

Solition would to define a array of the form field in your Action form, get each value and validate.

For example,

If there is a form field with name "f1" repeating in your form, then in the ActionForm have a getter and setter methods for f1[]. When your form is submitted, the values will be set to this array.

from your validate method, validate the values of form field by looping through the array f1[].

Hope this helps
Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to Validate this?
 
Similar Threads
How to make text field disabled using html tag?
Display character for HTML Number
Struts Validator-Validating an Integer Form Field
Struts: No getter method for property name problem
Auto tabbing within struts iterate using js