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]



Reply via email to