Univention Bugzilla – Bug 30109
form.validate() does not hit every widget
Last modified: 2013-05-10 17:22:12 CEST
A form.validate() iterates over all form widgets and validates them. This is done via widget.validate(). If this function is not found, the widget is silently skipped, producing Bugs like the cloned one.
Every widget should implement a validate() function. At least PasswordInputBox and TimeBox lack this functionality. In general, Widgets that encapsulate dijit.form.Widgets through ContainerWidgets are prone to this error.
In addition, the form.validate() function should not skip a widget without validate(), but instead fall back to isValid() and console.warn() the developer (if not throw an exception...). This way we can also handle future Widgets that forgot to implement the function.
+++ This bug was initially created as a clone of Bug #30091 +++
* It is possible to set an empty password for new users.
* It is not validated whether the first password matches the second. A red
exclamation mark may appear but that does not prevent the form from being
submitted. The first password input is chosen as the password.
PasswordInputBox and TimeBox has the logic in isValid.
I added a function validate() which return isValid() to _FormWidgetMixin.
isValid is btw obsolete in Dojo 2.0.
* add validate function to _FormWidgetMixin; Bug #30109
(In reply to comment #1)
> PasswordInputBox and TimeBox has the logic in isValid.
> I added a function validate() which return isValid() to _FormWidgetMixin.
> isValid is btw obsolete in Dojo 2.0.
Yes, isValid() → get("state") ... from the API documentation in dijit/form/_FormMixin:
> Will be "Error" if one or more of the child widgets has an invalid value,
> "Incomplete" if not all of the required child widgets are filled in. Otherwise,
> "", which indicates that the form is ready to be submitted.
Changes: OK as workaround, PasswordInputBox and TimeBox are working
UCS 3.1-1 has been released:
If this error occurs again, please use "Clone This Bug".