I'm using knockout validation to validate a form. Each field has a custom set of rules.
In my application an administrator should have the rights to chose some rules from a predefined set of rules for a specific field. I will have button for each input field that will open a modal where all the rules will be displayed is a check box and the administrator should be able to chose from them an define custom params or messages.
My question is: How can I define the rules and then pass them to ko.observable.extend(rules)
so I could change the ones that I validate against in the application view.
I tried sending them as a string but no success:
var lastNameRules = '{ minLength: 2, required: true }';
var lastName = ko.observable().extend(lastNameRules);