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

Short form not expanded for errors on submission

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Test the fix for client-side validation in forms with randomised ids:

      1. Place 'testform.php' in your web root and access it
      2. Open browser dev tools -> console and make sure 'persist logs' is enabled (or equivalent). Leave the console open.
      3. Click on "Collapse me" to collapse the fieldset
      4. Click on Submit
        1. Confirm that the section was opened
        2. Confirm that there is an error immediately below the field
        3. Confirm that the field error was focused
        4. Confirm that you don't see any JS errors in the console
      5. Submit the form again, watching for a browser post. Verify nothing is posted.
      6. Reload the page to clear the validation error
      7. Click in the text field
      8. Press the [tab] key
        1. Confirm that there is an error immediately below the field

       Regression test 1: Confirming this works for forms without randomised ids (the vast majority of cases in Moodle):

      1. Edit 'testform.php' and change:

        ['data-random-ids' => 1]

        to:

        ['data-random-ids' => 0]

        thus disabling the randomised ids.

      2. Repeat all of the previous tests

      Regression test 2: Confirming client side validation works when multiple forms are used and when randomisation of ids is enabled

      N.B. This test is based on the test in MDL-65217, but adds client side validation test steps.

      1. Place 'testmultipleforms.php' in your web root and access it
      2. Open browser dev tools -> console and make sure 'persist logs' is enabled (or equivalent). Leave the console open.
      3. Click on "Collapse me" to collapse the fieldset for both forms
      4. Click on Submit
        1. Confirm that the section was opened in the form that you submitted
        2. Confirm that there is an error immediately below the field
        3. Confirm that the field error was focused
        4. Confirm that you don't see any JS errors in the console
      5. Submit the form again, watching for a browser post.
        1. Confirm that there is no entryin the NEtwork tab to suggest that the form was submitted
      Show
      Test the fix for client-side validation in forms with randomised ids: Place 'testform.php' in your web root and access it Open browser dev tools -> console and make sure 'persist logs' is enabled (or equivalent). Leave the console open. Click on "Collapse me" to collapse the fieldset Click on Submit Confirm that the section was opened Confirm that there is an error immediately below the field Confirm that the field error was focused Confirm that you don't see any JS errors in the console Submit the form again, watching for a browser post. Verify nothing is posted. Reload the page to clear the validation error Click in the text field Press the [tab] key Confirm that there is an error immediately below the field  Regression test 1: Confirming this works for forms without randomised ids (the vast majority of cases in Moodle): Edit 'testform.php' and change: ['data-random-ids' => 1] to: ['data-random-ids' => 0] thus disabling the randomised ids. Repeat all of the previous tests Regression test 2: Confirming client side validation works when multiple forms are used and when randomisation of ids is enabled N.B. This test is based on the test in MDL-65217 , but adds client side validation test steps. Place 'testmultipleforms.php' in your web root and access it Open browser dev tools -> console and make sure 'persist logs' is enabled (or equivalent). Leave the console open. Click on "Collapse me" to collapse the fieldset for both forms Click on Submit Confirm that the section was opened in the form that you submitted Confirm that there is an error immediately below the field Confirm that the field error was focused Confirm that you don't see any JS errors in the console Submit the form again, watching for a browser post. Confirm that there is no entryin the NEtwork tab to suggest that the form was submitted
    • Affected Branches:
      MOODLE_310_STABLE, MOODLE_39_STABLE
    • Fixed Branches:
      MOODLE_310_STABLE, MOODLE_39_STABLE
    • Pull 3.9 Branch:
    • Pull 3.10 Branch:
      MDL-70987-310
    • Pull 3.11 Branch:
      MDL-70987-311
    • Pull Master Branch:
      MDL-70987-master
    • Sprint:
      Internationals - 3.11 Sprint 7

      Description

      This is a regressionf rom MDL-66106. At the moment the elementid is passed with a value of the formid.
      $this houdl be $elem for the errorid calculation

        Attachments

        1. Screenshot_1.jpg
          Screenshot_1.jpg
          61 kB
        2. Screenshot_2.jpg
          Screenshot_2.jpg
          75 kB
        3. Screenshot_3.jpg
          Screenshot_3.jpg
          75 kB
        4. testform.php
          1.0 kB
        5. testmultipleforms.php
          0.8 kB

          Issue Links

            Activity

              People

              Assignee:
              dobedobedoh Andrew Nicols
              Reporter:
              dobedobedoh Andrew Nicols
              Peer reviewer:
              Jake Dallimore
              Integrator:
              Jun Pataleta
              Tester:
              Janelle Barcega
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                8/Mar/21

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 3 hours, 20 minutes
                  3h 20m