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

Modal forms module has couple of small problems

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Waiting for peer review
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.11, 4.0
    • Fix Version/s: None
    • Component/s: Forms Library
    • Labels:
    • Testing Instructions:
      Hide
      1. Install a plugin from https://github.com/marinaglancy/moodle-local_modalformexamples (if you installed it earlier - update it to the latest version)
      2. Go to Site administration>Development>Modal form examples
      3. Open browser console, make sure no errors related to modal forms appear in the console during the test
      4. Navigate to test 2: try opening form clicking both links (with and without data), make sure values populate for the name and two options
      5. Set name to "error", submit the form, make sure there is a notification
      6. Navigate to test 4: try opening form with and without arguments, make sure arguments populate for the name and two options
      7. Set name to "error", submit the form, make sure there is a notification
      Show
      Install a plugin from https://github.com/marinaglancy/moodle-local_modalformexamples (if you installed it earlier - update it to the latest version) Go to Site administration>Development>Modal form examples Open browser console, make sure no errors related to modal forms appear in the console during the test Navigate to test 2: try opening form clicking both links (with and without data), make sure values populate for the name and two options Set name to "error", submit the form, make sure there is a notification Navigate to test 4: try opening form with and without arguments, make sure arguments populate for the name and two options Set name to "error", submit the form, make sure there is a notification
    • Affected Branches:
      MOODLE_311_STABLE, MOODLE_400_STABLE
    • Pull 3.11 Branch:
      MDL-71686-311
    • Pull Master Branch:
      MDL-71686-master

      Description

      When we started moving all workplace forms to https://docs.moodle.org/dev/Modal_and_AJAX_forms we found a couple of errors introduced during re-writing from jquery to ES6 and also when making changes during integration review:

      1. The error handler does not bind "this" and on submission error (for example, if there was an exception during processing), the notification is not displayed, instead there is a JS error "'this' is undefined"

      2. It is not possible to pass arrays as arguments - they reach the form as comma-separated string

      const args = {programid: 15, programuserids: [15,2,3,8]};
      const searchParams = new URLSearchParams(Object.entries(args));
      console.log(searchParams.toString());
      // Actual: programid=15&programuserids=15%2C2%2C3%2C8
      // What we expect: programid=15&programuserids[]=15&programuserids[]=2&programuserids[]=3&programuserids[]=8
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              marina Marina Glancy
              Reporter:
              marina Marina Glancy
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:

                  Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 2 hours, 10 minutes
                  2h 10m