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

Incorrect validation workshop form if decimal separator is ',' for example spanish international

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Duplicate
    • Affects Version/s: 3.1
    • Fix Version/s: None
    • Component/s: Forms Library, Workshop
    • Labels:
      None
    • Affected Branches:
      MOODLE_31_STABLE

      Description

      When changing to a language whith a comma like decimal separator (example: English to Spanish), I get an error messing when the form validatesthe following fields:
      'submission grade to pass'
      'assestment grade to pass'

      I've traced back the source code and I've detected that the issue comes from the script formslib.php which generates validation functions with incorrect regular expressions, when the language is set up with the comma as decimal separator (which is the case of the Spanish language, in opposite to English which uses '.'):

      var regex = /(?\d\d*\.\d*$)|(?\d\d*$)|(^-?*.\d\d$) /;

      According to the Spanish setup, the correct expression should be

      var regex = /(?\d\d**,\d$)|(?\d\d*$)|(^-?*,\d\d$)/; (whith comma , not point)

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              randion randion
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona)
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: