We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
ko.validation.init(); function Address() { var self = this; self.availableCountries= ['AU', 'NZ', 'US']; self.availableStates = ['Alabama', 'Alaska', 'Arizona', 'Arkansas']; self.country = ko.observable().extend({required: true}); self.state = ko.observable().extend({required: {onlyIf: function() {return self.country() === 'US';}}}); }; var address = ko.validatedObservable(new Address())(); ko.applyBindings(address);
See the example here on jsFiddle.