[ 
https://issues.apache.org/jira/browse/EXTVAL-46?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12719335#action_12719335
 ] 

Gerhard Petracek commented on EXTVAL-46:
----------------------------------------

the common solution:
you can use the rendered attribute of your component(s) and hide all options 
which won't make sense (due to an other selection).
that's also better for the user - just display information which are really 
needed.

or do you try to reduce server roundtrips?
in such a case you could use an add-on like:
http://os890.blogspot.com/2009/06/myfaces-extval-add-on-conditional.html
as condition use a property of a bean to resolve the result or you can directly 
reference a request value.
any el-expression which results in a boolean result is valid.

an attribute to reference a special component-id won't be proper in this case, 
because you would bind your model to a specific part of a page or you force the 
same component-id if you have a second page which uses the same property. if 
you don't care about that, you are free to impl. your own version of 
@SkipValidation which provides such an attribute. extval is very pluggable. as 
you can see at the os890 add-ons it's quite easy to add/remove metadata for a 
special property based on any condition/mechanism. if you need any help for 
your requirement, you know how to contact me directly. we already implemented 
such use-cases without problems. since there are existing solutions and/or 
possibilities, i would like to close this feature-request. (however, i'm also 
available for further discussions.)

--

fyi:
i don't really know what you mean with "second validation phase" - if you call 
cross-validation the 2nd validation phase, it's not true. cross-validation gets 
triggered within the normal validation phase and so @SkipValidation works the 
same way for both.

hint:
@Required isn't needed, if you are using a custom value at the minimum 
attribute of @Length. so you can reduce metadata hosted by a property. use 
@Required, if you don't have @Length at your property (or @Length just provides 
a maximum) or you would like to display a special required violation message or 
you would like to use severity aware validation for just one of the two 
constraints or ...

> Referencing other properties for the skip validation strategy
> -------------------------------------------------------------
>
>                 Key: EXTVAL-46
>                 URL: https://issues.apache.org/jira/browse/EXTVAL-46
>             Project: MyFaces Extensions Validator
>          Issue Type: New Feature
>            Reporter: Stefan Meyer
>
> I would like to skip validation of property a based on an evaluation of 
> properpty b. Similar to RequiredIf but as powerfull as skipvalidation - 
> basically an extension to skipvalidation.
> Extval seems to be validating in more than one phase.  So the skip validation 
> stuff seems to be over when cross validation begins. That is why i did not 
> try really hard to do it.

-- 
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