This is a migrated thread and some comments may be shown as answers.

How to configure custom validation for CRUD in grid using popup and template

3 Answers 350 Views
Grid
This is a migrated thread and some comments may be shown as answers.
ya
Top achievements
Rank 1
ya asked on 14 Sep 2012, 02:18 AM
Hi

I have seen lots of examples of how to configure custom validation in grid model to support CRUD.

If you use a popup for editing, but don't specify a template, it works as expected.  The custom rules fire and the popup will not close until errors are fixed.

I cannot find any examples of how to apply custom rules to my model when using a template with a popup.  I need the template to support my CRUD requirements, the default editor doesn't cut it.  I also need some custom validation rules.

It seems as though the custom rules on my schema model are never executed when I specify my template for the popup editing..

I have tried guessing the syntax of using declarative binding for the custom validation, without success.

I have tried hooking into the edit event on the grid and attaching a validator to the popup container.  My custom rules are executed, but not as expected.  They only fire when the values of my controls change, but if you hit the update button again, the popup window closes accepting the invalid data.

I have modified one of the existing CRUD template samples here.  http://jsfiddle.net/yamaan608/Svweg/1/ .

In the example, you can see the template is commented out and the validation works fine.  A custom rule is applied to the age.  If you uncomment the template, you will see no validation takes place.

Any pointers greatly appreciated.

3 Answers, 1 is accepted

Sort by
0
Bryan
Top achievements
Rank 1
answered on 02 Oct 2012, 01:08 AM
Ya,

You have to upgrade your Kendo version. I modified your jsfiddle sample using Kendo version 2012.2.913 and it works as expected.

jsfiddle gid popup with custom validation sample

Hope this helps.

-Bryan
0
Wiktor
Top achievements
Rank 1
answered on 12 Nov 2012, 10:33 PM
Hi,
In the example you provided, the custom validation works fine, but the "required: true" doesn't work. I am using latest Kendo Beta v2012.3.1024, and it doesn't work there either.

Cheers,
Wiktor
0
Bryan
Top achievements
Rank 1
answered on 21 Nov 2012, 01:36 PM
Wiktor,

Try adding the "required" keyword to the input tag.
<input type="text" name="Age" data-type="number" data-bind="value:Age" data-role="numerictextbox"  required/>

I hope this helps,
-Bryan
Tags
Grid
Asked by
ya
Top achievements
Rank 1
Answers by
Bryan
Top achievements
Rank 1
Wiktor
Top achievements
Rank 1
Share this question
or