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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 3.4.2, 3.5, 3.6
    • Fix Version/s: None
    • Component/s: Forms Library
    • Labels:
      None
    • Affected Branches:
      MOODLE_34_STABLE, MOODLE_35_STABLE, MOODLE_36_STABLE

      Description

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

       

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              daniss Daniele Cordella
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated: