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

Failing server side mform validation does not scroll to first error using clean

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Deferred
    • Icon: Major Major
    • None
    • 3.4.2, 3.5, 3.6
    • Forms Library
    • None
    • MOODLE_34_STABLE, MOODLE_35_STABLE, MOODLE_36_STABLE

      Clean theme + server side validation fails

       

      To reproduce:

      Download the attached test_form.php file and copy it to your local mooodle test server.
      Set $CFG->allowthemechangeonurl = true; if you need it.

      ---------
      1a) Navigate to your localhost/moodle/test_form.php?theme=boost
      Be sure to have ?theme=boost at the end of your URL.
      The form is 30 text fields long. I added so many fields because I want to have a very high form.
      The 20th field, named 'itemname20', is mandatory.
      This form verify the mandatory field using a server side validation if $useserversidevalidation = true; at line 23
      and a client side validation if $useserversidevalidation = false;.
      2) Once you have the file loaded, reduce the heigth of your browser window to less than 10 cm.
      3) Scroll the page to the end and take care to have the mandatory field not visible in your so small window.
      4) Submit the form.
      You are going to perform a server side validation using boost.
      Of course the form validation fails because itemname20 is empty and the form is reloaded.
      At reload time the form scrolls to display the field 'itemname20'.
      Correct! \o/

      ---------
      Now edit the file test_form.php and change line 23 from
      $useserversidevalidation = true;
      to
      $useserversidevalidation = false;
      You are going to perform a client side validation using boost.

      Execute again steps from 1 to 4.
      At reload time the form scrolls to display the field 'itemname20'.
      The outcome is still correct! \o/

      ---------
      Replace step 1a of the procedure with:
      1b) Navigate to your localhost/moodle/test_form.php?theme=clean
      and restart the process starting from 2.

      Be sure to have ?theme=clean at the end of your URL.
      You are going to perform a client side validation using clean.
      carry on up to step 4 and...
      At reload time the form scrolls to display the field 'itemname20'.
      The outcome is still correct! \o/

      ---------
      Now edit the file and undo the changes you made in line 23
      So change line 23 from:
      $useserversidevalidation = false;
      to
      $useserversidevalidation = true;
      You are going to perform a server side validation using clean.

      Execute again steps from 2 to 4.
      but the form is not scrolled to diplay field 'itemname20'.

       

        1. test_form_checkbox.php
          2 kB
          Daniele Cordella
        2. test_form.php
          1 kB
          Daniele Cordella

            Unassigned Unassigned
            daniss Daniele Cordella
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

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