Bug 30109 - form.validate() does not hit every widget
form.validate() does not hit every widget
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UMC (Generic)
UCS 3.1
Other Linux
: P3 normal (vote)
: UCS 3.1-1
Assigned To: Florian Best
Alexander Kläser
:
Depends on: 30091
Blocks: 31337
  Show dependency treegraph
 
Reported: 2013-01-22 14:01 CET by Dirk Wiesenthal
Modified: 2013-05-10 17:22 CEST (History)
4 users (show)

See Also:
What kind of report is it?: ---
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Ticket number:
Bug group (optional): Troubleshooting, Usability
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dirk Wiesenthal univentionstaff 2013-01-22 14:01:57 CET
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.
Comment 1 Florian Best univentionstaff 2013-03-08 09:28:58 CET
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.

univention-management-console-frontend (2.0.219-1) 
* add validate function to _FormWidgetMixin; Bug #30109
Comment 2 Alexander Kläser univentionstaff 2013-03-22 13:07:14 CET
(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
Changelog: OK
Comment 3 Stefan Gohmann univentionstaff 2013-03-25 19:56:58 CET
UCS 3.1-1 has been released: 
 http://download.univention.de/doc/release-notes-3.1-1_en.pdf
 http://download.univention.de/doc/release-notes-3.1-1.pdf

If this error occurs again, please use "Clone This Bug".