[validation] Is it possible to have dynamic rules
I have a series of fields and if one of them is filled out I want to make the rest of them required. So I made a function that checks all the fields and returns true or false. I tried to put that function in my required rule like this:
- rules: {
- MyField: {
- required: function(element) {
- MyTestFunction();
- }
- }
- }
This worked fine, but if all the fields were cleared it doesn't turn the required off like I want it to.
Any suggestions on how to make this work?