Bug 30109

Summary: form.validate() does not hit every widget
Product: UCS Reporter: Dirk Wiesenthal <wiesenthal>
Component: UMC (Generic)Assignee: Florian Best <best>
Status: CLOSED FIXED QA Contact: Alexander Kläser <klaeser>
Severity: normal    
Priority: P3 CC: best, gohmann, klaeser, schwardt
Version: UCS 3.1   
Target Milestone: UCS 3.1-1   
Hardware: Other   
OS: Linux   
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: Flags outvoted (downgraded) after PO Review:
Ticket number: Bug group (optional): Troubleshooting, Usability
Max CVSS v3 score:
Bug Depends on: 30091    
Bug Blocks: 31337    

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".