Completed
Last Updated: 05 Jul 2021 13:15 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.
2 comments
ADMIN
Ianko
Posted on: 05 Jul 2021 13:15

Hello,

We have the Validator integrated into the Form component which can be instantiated via MVVM syntax and can serve as a better alternative as you have the ability to create an entire form with a good looking predefined layout and have the validation on hand.  

https://demos.telerik.com/kendo-ui/form/mvvm

Regards,
Ianko
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

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.