Custom control on a form - this.objPull is not a function

Hello all,

I have added a custom control to my form but during the loading of the form I get the “this.objPull[(this.idPrefix + n)][l] is not a function” error. (see attached screenshot of the full error. If I comment out the custom line the form will load up with no problems.

I’m loading data like this:

[code]var template = {

"page1Data": [
   { "type": "label", "name": "title", "label": "label Name here"},
   { "type": "myItem", "name": "myCustomField" },
   { "type": "label", "name": "page1", "label": "another label"}
]}[/code]

The custom control is ‘myItem’. I have set up my custom item as follows:

[code]dhtmlXForm.prototype.items.myItem = {

render: function (item, data) {

    item._type = "myItem";
    item._enabled = true;

    canv = document.createElement('canvas');
    canv.setAttribute("id", "canvasID");
    ctx = canv.getContext("2d");
    item.appendChild(canv);

    return this;
},

setValue: function (item, val) {
    item._value = val;
},

getValue: function (item) {
    return item._value;
}

};[/code]

It will create the control on the page (in this case, a canvas) but of course the error stops other controls from being loaded correctly. Do I need to be doing something else first before calling this?

So I found my problem after more time digging. I was not creating the enable: function(item){} line in my code. Once I added that to the render/setValue/getValue functions it worked fine.