Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-27728

javascript form validation library

    XMLWordPrintable

Details

    • Any
    • MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE
    • MOODLE_20_STABLE, MOODLE_21_STABLE
    • wip-mdl-27728
    • Easy
    • Hide

      Can't think of a case where this case is reproducible. But make sure all the forms with required field get submitted.
      1. Login as student
      2. Edit profile (Settings -> Edit profile)
      3. Try updating profile with empty required fields.
      4. Form should not be submitted and display error message on fields.
      5. Try add valid values and forms should be submitted.

      Try perform similar testing on other forms with required fields and make sure form is not submitted with invalid input.

      Show
      Can't think of a case where this case is reproducible. But make sure all the forms with required field get submitted. 1. Login as student 2. Edit profile (Settings -> Edit profile) 3. Try updating profile with empty required fields. 4. Form should not be submitted and display error message on fields. 5. Try add valid values and forms should be submitted. Try perform similar testing on other forms with required fields and make sure form is not submitted with invalid input.

    Description

      Within lib/formslib.php on form submit, the code is intended to step through the form elements and validate the value of each element.

      Unfortunately, there are occasions when the element variable within the loop is undefined. This throws an exception. Since the form action has on exception return true, the form then gets submitted even though its values might not pass validation.

      This can be avoided as follows:

      Around line 1764 find

      function validate_' . $this->_formName . '_' . $escapedElementName . '(element) {

      Insert the following lines after it:

      if( undefined == element ){
           return false;
      }

      Then, around lines 1769 - 1774, find the range of lines beginning with

      var frm = element.parentNode;

      and ending with

      return qf_errorHandler(element, _qfMsg);

      Enclose this block in a condition like this:

          if( undefined != element.name ){
            var frm = element.parentNode;
            while (frm && frm.nodeName.toUpperCase() != "FORM") {
             frm = frm.parentNode;
            }
      ' . join("\n", $jsArr) . '
       
            return qf_errorHandler(element, _qfMsg);
          }

      Attachments

        Issue Links

          Activity

            People

              rajeshtaneja Rajesh Taneja
              jballard James Ballard
              Rossiani Wijaya Rossiani Wijaya
              Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
              Michael de Raadt Michael de Raadt
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Clockify

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.