My form is composed of 2 options: either to pay with a credit card or with a check. If you pay with a check simply click the Check Box and you are done. If you didn�t � that means you are paying with a credit card.
1. How to instruct the validation.xml to do this: if the checkbox is selected � don�t bother checking for errors on the credit card (required fields).
2. The credit card is composed of typeOfCreditCard and it�s a drop down box (code below). Since this is a required field � how can I instruct the validation.xml that 'Select One' is not a valid input?
1. Use the validWhen validation rule. This link explains how to use it.
This will work only if you're just validating that some value was placed in the credit card number field. If you need to do a check-sum or anything more sophisticated than that, you will have to write your own custom validation rule in order to make this work.
2. Code the "Select One" option like this:
<html:option value="">Select One</html:option>
If you do it this way, the required validation will work because the value of creditType will be a null string if this option is selected.
I tried all different combinations....none works. I realized that when I type �validwhen� in the validation.xml the error.creditType.required doesn�t work. Meaning even if I click (or not) the checkbox (in the jsp page) nothing happens � no error message.