Standard validations on custom item

Hi again,

I have developed a “custom item” for dhtmlXForm. I would like it to be validated with the standard validations. Specifically, I am interested in the “required” attribute and “NotEmpty” validation.

However, even when I am implementing “getData” correctly and I initialize the item with the required configurations, these validations aren’t raised.

Is there something I should implement on my “custom item” in order to add support for these standard validations? Or I am forced to add ‘custom validations’ to simulate these standard validations?

Hi

please provide completed demo and some words how to reproduce
you also can send it to support@dhtmlx.com

Hi,

I am attaching the demo.

There are two items. The first one is a standard ‘input’ item. The second one is a ‘custom item’. Both are configured with ‘NotEmpty’ standard validation.

To “select a value” on the second item, press the “Select item…” button and double-click on a row of the grid that appears.

So, to reproduce:

  • Fill the first item
  • Click “Validate” button placed at the bottom. An alert will be shown with the text “Form is VALID” even if nothing is selected for the second item.

It is clear that ‘NotEmpty’ standard validation is not performed over the custom-item.

The question again: Should I write a ‘custom validation’ or I am missing something that blocks the ‘NotEmpty’ standard validation?
dhtmlxFormDemo.zip (159 KB)

Hi

thanks for demo

you need to add item._enabled attr, now it undefined, form “think” item is not enabled and do not call validation

…myItem = {
render: function(){
item._enabled = true;
}

we will fix docs

I added the required attribute and the problem is solved.

Thank you for your help!