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

Stefan Meyer commented on EXTVAL-46:
------------------------------------

I want to use the skipvalidation conditional expression to use componente 
values - as in cross validation.

Very common example:

The user may choose between two payment types via radio buttons. between the 
radio buttons are the text fields associated with those payment types:

(0) credit
  creditcardnumber [                        ]
  institute [               ]
( ) debit
  bankcode [                ]
  accountnumber [            ]

My model looks like this:

class Form {

@Required
private PaymentTypeEnum paymentType;

@SkipValidation(input={"paymentType"},"${0}!='CREDIT')
@Required
@Length(minimum = 6, maximum = 20)
private String creditcardnumber ;

@SkipValidation(input={"paymentType"},"${0}!='CREDIT')
@Required
@Length(minimum = 6, maximum = 20)
private String institute ;

@SkipValidation(input={"paymentType"},"${0}!='DEBIT')
@Required
@Length(minimum = 6, maximum = 20)
private String bankcode ;

@SkipValidation(input={"paymentType"},"${0}!='DEBIT')
@Required
@Length(minimum = 6, maximum = 20)
private String accountnumber ;

}

I want to skip validation for the fields that are not associated with the 
selected payment type.

I suggest a property "input" for skipValidation that defines other properties 
to be referenced by index (${i}) in the expression. The issue I see is that 
this skipoValidation can only be eceuted in extval's second validation phase 
and thus is not effective for the validations in the first phase. One would 
actually have to move all validations to the second phase??!!!




> 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