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

Move moodleforms validation functions to a self-contained function

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Sorry, but you might need to check code and inspect the DOM to test this, we are changing the client side of moodleform's validation, I don't want you to test the forms I've already used because the more stuff we can test the better. Search out as many client side validated mforms you can and try to break it please.

      1. Open a page with a form with client validation, some ideas: find . -name "*_form.php" | xargs grep "addRule.*client"
      2. Focus on a field with client rules (like required for example) and move the focus out from the field without satisfying the rule
      3. You SHOULD see the tipical moodle forms error
      4. Focus on a field with client rules (like required for example) and make the field happy with a valid value and move the focus somewhere else
      5. The error div should be hidden
      6. Try to submit the form with empty values on required fields
      7. You SHOULD NOT be able to do it
      8. Try to submit the form with values not matching the specified rules (no required rule, other rules please)
      9. You SHOULD NOT be able to do it
      10. Make the form happy and submit it, you SHOULD NOT see any error and the form should be submitted
      1. Go to a page with a form, a addRule.*client.*required and a 'Cancel' button.
      2. Leave the required fields empty
      3. Press 'Cancel', you SHOULD be redirected to another page as usual
      1. Open a page with no rules and inspect the DOM
      2. You SHOULD NOT see any qf_errorHandler JS function around
      1. Open a page with rules, but only server side (not a single client side one) and inspect the DOM
      2. You SHOULD NOT see any qf_errorHandler JS function around
      Show
      Sorry, but you might need to check code and inspect the DOM to test this, we are changing the client side of moodleform's validation, I don't want you to test the forms I've already used because the more stuff we can test the better. Search out as many client side validated mforms you can and try to break it please. Open a page with a form with client validation, some ideas: find . -name "*_form.php" | xargs grep "addRule.*client" Focus on a field with client rules (like required for example) and move the focus out from the field without satisfying the rule You SHOULD see the tipical moodle forms error Focus on a field with client rules (like required for example) and make the field happy with a valid value and move the focus somewhere else The error div should be hidden Try to submit the form with empty values on required fields You SHOULD NOT be able to do it Try to submit the form with values not matching the specified rules (no required rule, other rules please) You SHOULD NOT be able to do it Make the form happy and submit it, you SHOULD NOT see any error and the form should be submitted Go to a page with a form, a addRule.*client.*required and a 'Cancel' button. Leave the required fields empty Press 'Cancel', you SHOULD be redirected to another page as usual Open a page with no rules and inspect the DOM You SHOULD NOT see any qf_errorHandler JS function around Open a page with rules, but only server side (not a single client side one) and inspect the DOM You SHOULD NOT see any qf_errorHandler JS function around
    • Affected Branches:
      MOODLE_31_STABLE
    • Fixed Branches:
      MOODLE_31_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-52826_master
    • Sprint:
      3.1 Sprint 3

      Description

      moodleforms form validation function live in the global JS namespace, ideally they should live in a self-contained JS function so we don't pollute global and memory can be freed once the fields and the form that is being validated are not available any more in the DOM. These changes would help MDL-52715 as all the form validation stuff would be removed once the form is removed from the DOM.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  23/May/16