Allow for Required Option in VisitorFieldValidator
--------------------------------------------------

                 Key: WW-3477
                 URL: https://issues.apache.org/jira/browse/WW-3477
             Project: Struts 2
          Issue Type: Improvement
          Components: Other
            Reporter: Robert Nelson
            Priority: Minor


A number of projects I'm working on make use of the VisitorFieldValidator to 
pass validation handling back to our entity beans. In some cases we have a bean 
being set which is completely optional for the user. One example would be a 
Phone object representing a fax number. We have a bean, and it needs validation 
if they gave filled in those form fields, but if they didn't we don't need 
validation at all. If we apply the VisitorFieldValidator to that bean in the 
action it always validates against the bean even if the bean is completely 
empty (or filled with empty Strings). I would like to have the ability to mark 
a VistiorFieldValidation as optional, meaning if no properties were passed in 
for that bean it would not execute that bean's validators.

I've written a custom validator to accomplish this which I've been using for a 
while, but I'd like to see this feature in the provided validator so others can 
use it. I imagine adding a property on the VisitorFieldValidator called 
"required" which would default to "true".

I'm willing to write the code for this, but I'd like some input on the idea and 
some instructions on how I can help.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to