Closed adarshpastakia closed 8 years ago
I don't think that we are going to add conditional validation. Instead, I think this is better handled by a simple custom validation rule. @jdanyow Can you provide some advice here?
@EisenbergEffect This isn't exactly a custom validation situation, it more like having a set of properties whose validation rules need to be applied only when a certain condition is met. Something like an online purchase form where the 'Shipping address' properties are required, and if the user unchecked 'Billing address same as shipping' then i need to validate the billing address, or the payment type where the user can choose 'Cash on Delivery'/'Credit Card', incase the user chooses COD i don't really need to validate credit card for required and luhn algorithm validation, but if the user chooses CreditCard then the related properties need to be validated. As for having a custom validation to check against luhn algorithm is not an issue, i have created custom validation rules and decorators.
+1
+1
this was added in the last release
In my form i have two address entries one for home and one for business, the business address entry is controlled by a checkbox. So if a user enables the business address entry i need to validate the required fields, if not i need to skip the validation. Maybe something like an if decorator that returns true/false, or checks a related property.