Moodle
  1. Moodle
  2. MDL-36433

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

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor 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
    • Rank:
      45264

      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.

        Issue Links

          Activity

          Hide
          Itamar Tzadok added a comment -

          A mini minor one character long fix.

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

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

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

          Makes sense to me. Thanks a lot Itamar.

          Could you create branches for master?

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

          Added branch for master. Thanks for reviewing.

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

          Thanks Itamar, this has been integrated now.

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

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

          Show
          Rajesh Taneja added a comment - Thanks Itamar, works fine. FYI: Attached test file which is used for testing.
          Hide
          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
          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: