I’m attempting to add an existing form to a layout that I’ve created and the form appears correctly in the layout, but will not validate correctly.
The code for the page is:
Sample Layout Heading 1
Sample Layout Footer 1
This is a very simple page and I thought it should work, but obviously, I’m not seeing why it will not validate. The handleValidate() function always returns true, whether or not there is data in the form fields. Since the validate attribute is set to NotEmpty, should validate() return failure (false?) on an empty field?
I’m using the latest version of the dhtmlx library, 3.x. What is missing, or what should I add to make this form work?
Some more information about the problem I’m having with the test form in the post above.
After digging into dhtmlXForm.js, it appears that the function validate() (line 611) fails to call each item in the existing form to validate itself. As a result, it returns the default value of the variable completed (line 617) which is true, therefore, validate() always returns true in this case.
It seems that the itemPull object (created on line 97), and specifically, the this.itemPull[a]._list (accessed on line 639) exists but has no items in it from the form. After tracing the call and code with Firebug, it appears that the itemPull object’s _list array is never loaded with the items from the form. This results in itemPull[a]._list being empty which is incorrect as the test form (in the post above) has 5 valid fields with the validate attribute set.
The dhtmlxForm object appears to be correctly attaching the existing test form as the this.cont (line 36) is correctly returning the parentObj and setting the form object’s style information (lines 38-48).
If you could determine the bug in itemPull that would probably solve the problem I’m experiencing.
This issue occurs because of myForm don’t know about field1…field5 inputs. Since dhtmlxForm 3.0 it not possible to initialize form from existing HTML form. You can initialize from from JSON object, load form structure from XML or from HTML
Thanks for the response. Option 2 (rethink the form) is in progress.