Moodle

The required form field notification is too eager

Details

  • Type: Bug Bug
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: 1.9
  • Fix Version/s: 2.0.8
  • Component/s: Forms Library
  • Labels:
    None
  • Database:
    Any
  • Affected Branches:
    MOODLE_19_STABLE
  • Fixed Branches:
    MOODLE_20_STABLE

Description

The required field notification should be shown only before the form is being submitted. Now, for example, clicking the "Unmask" check box when adding a user shows the red "Required" box for the password.

It's a minor thing, but the same happens in other places too. Could the check be done before submitting only, or is this the required functionality? Confuses and/or slightly annoys me, but if others want the check to be done eagerly, then "Won't fix" this...

Activity

Hide
Eloy Lafuente (stronk7) added a comment -

Yup,

I also have seen the client validation to be triggered before submit, in the middle of the form fulfil process. Is there any good reason to trigger it before submission?

Adding some people here and addressing to 1.9.1...

Show
Eloy Lafuente (stronk7) added a comment - Yup, I also have seen the client validation to be triggered before submit, in the middle of the form fulfil process. Is there any good reason to trigger it before submission? Adding some people here and addressing to 1.9.1...
Hide
Jamie Pratt added a comment -

Many of the validation rules built into formslib do validation on the client side.

The validation is done when the form field loses focus ie. when the cursor is in the form field and the user either tabs to the next form field or clicks on another form field - an error message will then be displayed if the entered text does not validate.

Show
Jamie Pratt added a comment - Many of the validation rules built into formslib do validation on the client side. The validation is done when the form field loses focus ie. when the cursor is in the form field and the user either tabs to the next form field or clicks on another form field - an error message will then be displayed if the entered text does not validate.
Hide
Samuli Karevaara added a comment -

Jamie, I understand that. But the side effect of this is that the form is often bugging me even though I'm not even thinking that I'm done yet. I'm not sure if the "required field lost focus, must alert the user" rule is a beneficiary one, maybe all the checks could only happen when the form is being actually submitted (on the client side, before submitting it to the server)?

Show
Samuli Karevaara added a comment - Jamie, I understand that. But the side effect of this is that the form is often bugging me even though I'm not even thinking that I'm done yet. I'm not sure if the "required field lost focus, must alert the user" rule is a beneficiary one, maybe all the checks could only happen when the form is being actually submitted (on the client side, before submitting it to the server)?
Hide
Harry Smith added a comment -

Must admit finding it very annoying too.

Show
Harry Smith added a comment - Must admit finding it very annoying too.
Hide
Rajesh Taneja added a comment -

Hello Samuil,

Current behavior might be annoying, but the purpose of the input validation is to help users fill out a form correctly, by defining required fields and allowed formats and by providing appropriate error messages when the condition for submission are not met. Saying so, it is always better to show error in advance rather then later. User also have notion of keeping an eye on what information is required and is not filled, so we might get bugs asking for existing feature later.

I am not sure if requested behavior is standard in web domain, but you can achieve required behavior by commenting following lines in lib/formslib.php

lib/formslib.php
$onBlur = $element->getAttribute('onBlur');
$onChange = $element->getAttribute('onChange');
$element->updateAttributes(array('onBlur' => $onBlur . $valFunc,
                                 'onChange' => $onChange . $valFunc));
Show
Rajesh Taneja added a comment - Hello Samuil, Current behavior might be annoying, but the purpose of the input validation is to help users fill out a form correctly, by defining required fields and allowed formats and by providing appropriate error messages when the condition for submission are not met. Saying so, it is always better to show error in advance rather then later. User also have notion of keeping an eye on what information is required and is not filled, so we might get bugs asking for existing feature later. I am not sure if requested behavior is standard in web domain, but you can achieve required behavior by commenting following lines in lib/formslib.php
lib/formslib.php
$onBlur = $element->getAttribute('onBlur');
$onChange = $element->getAttribute('onChange');
$element->updateAttributes(array('onBlur' => $onBlur . $valFunc,
                                 'onChange' => $onChange . $valFunc));

People

Dates

  • Created:
    Updated: