3
votes

I am using aurelia validation V4 in my SPA.

I am trying to re-configure the aurelia validation rules depending on an option selected in a dropdown.

I could not accomplish this because, each time newly added rules are appending to the existing set of rules.

What I am trying to do is, remove existing rules for a property and assign new rules.

how to re-configure Aurelia validation rules ?

1

1 Answers

1
votes

the returned ValidationGroup has a destroy() function on it:

this.validate = this.validation.on(this)
                  .ensure('blah')
                  .isNotEmpty();

this.validate.destroy();

That should detach the observers to the values, meaning that any old rules will no longer be enforced. I couldn't see whether this actually frees the memory associated with the ValidationGroup, so you might want to watch out for that. (though it still might)