Pending Review
Last Updated: 04 Oct 2016 14:18 by ADMIN
Franz
Created on: 25 Jun 2012 13:40
Category: Data Source
Type: Feature Request
19
Integrate validation into MVVM
It should be possible to specify a validate() method on each viewmodel that gets triggered each time a new model value is .set(). In case of an unsuccessful validation an error event or binding could be triggered.
1 comment
WT
Posted on: 16 Jun 2016 13:55
If the validator had binding support, It might look something like this:

<div id="container" data-role="validator" data-bind="rules: rules, events:{validate: onValidate}">
      <input......
</div>

One issue that I can think of is that the rules engine would need to have a model bound mode rather than dom. The viewmodel should only have concerns with the bound data rather than inspecting input elements.