You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by bj...@accenture.com on 2007/02/01 12:06:35 UTC

Check if field exists in Validator

Probably simple solution, but I can't find any solutions on Google.  I have two forms whom use the same validatorMethod.  However, in one form, a field doesn't exist, where it exists in the other form.  I want to check if the field exists and use that value in my validation.  Does anybody know how to fix this problem?

Tia



This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.  If you have received it in error, please notify the sender immediately and delete the original.  Any other use of the email by you is prohibited.

RE: Check if field exists in Validator

Posted by "Strachan, Paul" <Pa...@det.nsw.edu.au>.
What vaildator method - If you have 2 forms, why not just have 2
validator form definitions (one for each form).  Or is it you actually
have one form where for one mapping the field is mandatory, and the
other mapping the field is optional, and you wish to validate in both
actions?

Some solutions I know about are:

- in validator 1.2.0 onwards you can make use of the "extends" attribute


- using struts you can also override the getValidationKey() method (eg
see ValidatorActionForm)

- write your own custom validator

- maybe utilise the "page" attribute in the validator form mapping

If you still have problem please post the relevant struts and validator
mappings.

HTH
Paul

Also perhaps searching the struts-user list will return more refined
results than google (eg http://marc.theaimsgroup.com/?l=struts-user&w=2
)



-----Original Message-----
From: bjorn.de.bakker@accenture.com
[mailto:bjorn.de.bakker@accenture.com] 
Sent: Thursday, 1 February 2007 10:07 PM
To: user@struts.apache.org
Subject: Check if field exists in Validator

Probably simple solution, but I can't find any solutions on Google.  I
have two forms whom use the same validatorMethod.  However, in one form,
a field doesn't exist, where it exists in the other form.  I want to
check if the field exists and use that value in my validation.  Does
anybody know how to fix this problem?

Tia



This message is for the designated recipient only and may contain
privileged, proprietary, or otherwise private information.  If you have
received it in error, please notify the sender immediately and delete
the original.  Any other use of the email by you is prohibited.
**********************************************************************
This message is intended for the addressee named and may contain
privileged information or confidential information or both. If you
are not the intended recipient please delete it and notify the sender.
**********************************************************************

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org