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

Boost breaks javascript form validation

    XMLWordPrintable

Details

    • 5

    Description

      The Boost theme does not set id property for some form elements. Therefore, client-side validation fails on some occasions.

      Example:

       

      $items = ['' => 'Select', '1' => 'Item 1', '2' => 'Item 2'];
      $mygroup = [];
      $mygroup[] = $form->createElement('select', 'myselect', null, $items);
      $mygroup[] = $form->createElement('link', 'mylink', null, '#', 'Click here');
      $form->addGroup($mygroup, 'mygroup', 'Select set');
      $form->addGroupRule('mygroup', array('myselect' => array(array(null, 'required', null, 'client'))));
      

       
      Using Boost, users are able to submit the form even if they leave the required field empty.

      The reason is in file lib/formslib.php the following line fails:

       

      Y.Global.fire(M.core.globalEvents.FORM_ERROR, {formid: \'' . $this->_attributes['id'] . '\',
                                                     elementid: \'id_error_' . $escapedElementName . '\'});
      

      as there is no element with that element id in the page.

      This is fine in More or any other non-Boost based themes.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              rezaie9 Shamim Rezaie
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Clockify

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