Form validation

Can anybody take a look at my snippet and tell me why form validation identifies every condition as a failure, but does not highlight the fields as invalid?

http://webix.com/snippet/d820081c

I have tried a couple of different versions with the same results. It does not matter if I have valid data or not, validate() returns false.

I have tried this.getFormVew().validate(), and I have tried directly referencing the form $$('dlgUserFinder').validate().

Any help would be greatly appreciated!

Comments

  • Found the resolution in an older, slightly related post, while waiting for a response to this request.

    It turns out that both $$(form).validate() and $$(form).getValues() require that fields have a "name" property. Without that, you can get the values individually via $$(field_id).getValue(), but you cannot use either of the other two methods.

    I am sure there are other dependencies as well. It would be helpful if these dependencies were noted on their respective function pages, like the "validate()" and "getValues()" function definition pages, as well as the ui.form definition page. The current documentation makes it seem like ID and NAME are interchangeable methods of referencing fields and objects.

  • Yep, the name property is a key attribute for the inputs which should interact with the form. Otherwise, the form is just a container (a layout).

    The current documentation makes it seem like ID and NAME are interchangeable methods of referencing fields and objects.

    Not exactly. $$(field_id).getValue() is an input-related method, so it will work regardless of the parent container's type (form or layout). In its turn, thename is required whenever you need to access the field through the form (getValues, setValues or validate them).

    To indicate this for users, we added a badge to the main article about the ui.form. Thank you again for your notes.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!