dhtmlxEvent(window,“load”, function(){
dhxLayout = new dhtmlXLayoutObject(“myForm”, “1C”);
form = dhxLayout.cells(‘a’).attachForm(fields)
form.attachEvent("onChange", function(_name, _value, _changed) {
var fields= [{type:"input", name: "new", label: "NEW:"}]
form = dhxLayout.cells('a').attachForm(fields)})});
[/code]
I think what happens is when a form is re-loaded the event is still executing. I think this may work by using setTimeout() function but can’t be a good solution.
I’m going to re-code the program so that it doesn’t need to delete the form field which triggers the “onChange” event (it’s probably better for the program flow).
However it would be nice to know if this problem has a solution. Because it looks like a legitimate functionality.
Attached is the complete file. It loads with a one-cell layout that contains a single form field. There is an onChange event attached to the field. The event handler is supposed to “removeItem()” of that field and add a new field. A JavaScript error appears in the console:
Uncaught TypeError: object is not a function
c.childNodes.(anonymous function).childNodes.(anonymous function).onblur
I suspect it may be due to a DHTMLX core implementation. form_q.html.zip (589 Bytes)
Yes, I have. I mentioned setTimeOut() in my first post. Imo it is not a “clean” solution. If this is a problem in the DHTMLX core code I would be happy to see it addressed there. setTimeOut() in this case appears like a hack