I am working on an MVC page that requires conditional validation.
When the user selects a country from the drop-down list, if they select one of two countries, a field is displayed containing the two text fields that are required. I would like the validation to be activated in this case, and if they select any other country, then the field is hidden and the check will be deactivated.
There is currently a separate validation class (which inherits from ValidationSet) on the site that I did not create that handles all validations for this controller, and they validate using commands like ValidatePresence, ValidateDecimal and ValidateExpression, so I would like to stick with this format for consistency. eg
new ValidatePresence("countryId") {ErrorMessageFormat = "Please supply a country for delivery to"}
Does anyone have any ideas? Thanks
e-on source share