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

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

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Duplicate
    • 3.1
    • None
    • Forms Library, Workshop
    • None
    • 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

              Unassigned Unassigned
              randion randion
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Laurent David, Raquel Ortega, Sara Arjona (@sarjona)
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: