Re: Struts Validator and Hidden Field
Octavia, I bit of a guess on my part, but it sounds like you want to use the requiredif validator. This allows a particular field to be required (or not) based on other fields. The fact that this might be a hidden field should be, as pointed out by others, transparent to the validator. However, also pointed out is the most troubling question: if it is on a hidden field and your validation fails, what can your users possibly ever do to correct the situation? Octavia Yung wrote: Thanks for the responses, David and Wendy. In order to determine if a particular form field is required, I need to determine the property of another field. Therefore, I thought it would be best to hold this other property in a hidden field. I have tried to validate it as any other input field, but have not had any luck. Any suggestions/ideas? Thanks much! - Original Message - From: Wendy Smoak [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Thursday, August 28, 2003 3:36 PM Subject: RE: Struts Validator and Hidden Field I was wondering if it is possible to validate a hidden field using the Struts Validator framework. If so, an example would be extremely helpful. Validator is a separate project in the Jakarta Commons, it's not part of Struts proper. Sure you could validate a hidden field, but what's the poor user supposed to do when you toss back an error that such-and-such field is required? He can't DO anything about it, the field is hidden! (Unless perhaps there's client side scripting setting a value when he fills in a visible field?) I don't see it as any different than validating a text box, did you try it and it didn't work? By the time the request gets turned into a Form bean, Struts doesn't know or care that the field was hidden on the HTML form it came from. -- Wendy Smoak Applications Systems Analyst, Sr. Arizona State University, PA, IRM - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Struts Validator and Hidden Field
Octavia wrote: I have tried to validate it as any other input field, but have not had any luck. Any suggestions/ideas? Thanks much! You'll have to post some of your code before anyone will have any idea why it's not working. The Validator also logs copious amounts of info, you should be able to tell if your rule is getting picked up from the XML file by looking in the logs. -- Wendy Smoak Applications Systems Analyst, Sr. Arizona State University, PA, IRM
Struts Validator and Hidden Field
Hi Everyone, I was wondering if it is possible to validate a hidden field using the Struts Validator framework. If so, an example would be extremely helpful. Thanks in advance! Octavia
Re: Struts Validator and Hidden Field
As far as I was aware validating a hidden field is the exact same as validating any other field.. just make sure the name of the field in your html:hidden corresponds to a setter method in your form. Then create your own validate function within the form to check the variable is correct.. -David - Original Message - From: Octavia Yung [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, August 28, 2003 4:13 PM Subject: Struts Validator and Hidden Field Hi Everyone, I was wondering if it is possible to validate a hidden field using the Struts Validator framework. If so, an example would be extremely helpful. Thanks in advance! Octavia - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Struts Validator and Hidden Field
I was wondering if it is possible to validate a hidden field using the Struts Validator framework. If so, an example would be extremely helpful. Validator is a separate project in the Jakarta Commons, it's not part of Struts proper. Sure you could validate a hidden field, but what's the poor user supposed to do when you toss back an error that such-and-such field is required? He can't DO anything about it, the field is hidden! (Unless perhaps there's client side scripting setting a value when he fills in a visible field?) I don't see it as any different than validating a text box, did you try it and it didn't work? By the time the request gets turned into a Form bean, Struts doesn't know or care that the field was hidden on the HTML form it came from. -- Wendy Smoak Applications Systems Analyst, Sr. Arizona State University, PA, IRM
Re: Struts Validator and Hidden Field
Thanks for the responses, David and Wendy. In order to determine if a particular form field is required, I need to determine the property of another field. Therefore, I thought it would be best to hold this other property in a hidden field. I have tried to validate it as any other input field, but have not had any luck. Any suggestions/ideas? Thanks much! - Original Message - From: Wendy Smoak [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Thursday, August 28, 2003 3:36 PM Subject: RE: Struts Validator and Hidden Field I was wondering if it is possible to validate a hidden field using the Struts Validator framework. If so, an example would be extremely helpful. Validator is a separate project in the Jakarta Commons, it's not part of Struts proper. Sure you could validate a hidden field, but what's the poor user supposed to do when you toss back an error that such-and-such field is required? He can't DO anything about it, the field is hidden! (Unless perhaps there's client side scripting setting a value when he fills in a visible field?) I don't see it as any different than validating a text box, did you try it and it didn't work? By the time the request gets turned into a Form bean, Struts doesn't know or care that the field was hidden on the HTML form it came from. -- Wendy Smoak Applications Systems Analyst, Sr. Arizona State University, PA, IRM - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]