You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Lukasz Lenart (Jira)" <ji...@apache.org> on 2022/09/15 05:40:00 UTC

[jira] [Closed] (WW-3477) Allow for Required Option in VisitorFieldValidator

     [ https://issues.apache.org/jira/browse/WW-3477?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Lukasz Lenart closed WW-3477.
-----------------------------
    Resolution: Won't Fix

> 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
>             Fix For: 6.1.0
>
>
> 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 was sent by Atlassian Jira
(v8.20.10#820010)