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

MoodleQuickForm client side validation javascript failure when element name contains a dash (-)

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.3.2
    • Fix Version/s: 2.3.4, 2.4.1
    • Component/s: Forms Library
    • Labels:
    • Testing Instructions:
      Hide

      Create a Moodle form with a text element named 'field_-1' and a 'required' rule on the element.
      Open the form, leave the text field empty and submit.

      Expected: The form should not be submitted and an error message 'You must supply a value here.' should appear above the field.

      Show
      Create a Moodle form with a text element named 'field_-1' and a 'required' rule on the element. Open the form, leave the text field empty and submit. Expected: The form should not be submitted and an error message 'You must supply a value here.' should appear above the field.
    • Affected Branches:
      MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE, MOODLE_24_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-36433-master

      Description

      MoodleQuickForm client validation javascript failure when element name contains a dash . Dashes are not allowed in javascript variable/function names and have to be escaped but are not escaped in getValidationScript. Consequently, the call to rule validation scripts for such elements fails and client side validation is not performed.

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            itamart Itamar Tzadok added a comment -

            A mini minor one character long fix.

            Show
            itamart Itamar Tzadok added a comment - A mini minor one character long fix.
            Hide
            salvetore Michael de Raadt added a comment -

            Thanks for reporting that and sharing a solution. Hopefully we can get it reviewed soon.

            Show
            salvetore Michael de Raadt added a comment - Thanks for reporting that and sharing a solution. Hopefully we can get it reviewed soon.
            Hide
            poltawski Dan Poltawski added a comment -

            Makes sense to me. Thanks a lot Itamar.

            Could you create branches for master?

            Show
            poltawski Dan Poltawski added a comment - Makes sense to me. Thanks a lot Itamar. Could you create branches for master?
            Hide
            itamart Itamar Tzadok added a comment -

            Added branch for master. Thanks for reviewing.

            Show
            itamart Itamar Tzadok added a comment - Added branch for master. Thanks for reviewing.
            Hide
            samhemelryk Sam Hemelryk added a comment -

            Thanks Itamar, this has been integrated now.

            Show
            samhemelryk Sam Hemelryk added a comment - Thanks Itamar, this has been integrated now.
            Hide
            rajeshtaneja Rajesh Taneja added a comment -

            Thanks Itamar, works fine.
            FYI: Attached test file which is used for testing.

            Show
            rajeshtaneja Rajesh Taneja added a comment - Thanks Itamar, works fine. FYI: Attached test file which is used for testing.
            Hide
            stronk7 Eloy Lafuente (stronk7) added a comment -

            Many thanks for your effort, the whole Moodle Community will be enjoying your great solutions starting now!

            Closing, ciao

            Show
            stronk7 Eloy Lafuente (stronk7) added a comment - Many thanks for your effort, the whole Moodle Community will be enjoying your great solutions starting now! Closing, ciao

              People

              • Votes:
                1 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  14/Jan/13