Open coderbond opened 8 years ago
Is it possible to use Conditional Validation along with Native Rules? Something like this for example.
self.validationObject = ko.validatedObservable({ Name: self.Name.extend({ required: true }), Type: self.Type.extend({ required: true }), Description: self.Description.extend({ required: true }), Price: self.Price.extend({ required: { number: true, onlyIf: function () { if (self.Classification() == 0){return false;} else{return true;} } } }) });
Yes, although I'm not sure if the "required" would support the "number" property. I think it needs to be something like this:
number: { params: true, onlyIf: function () { // etc
Is it possible to use Conditional Validation along with Native Rules? Something like this for example.