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

Mandatory fields accepting space as input

    XMLWordPrintable

    Details

    • Database:
      MySQL
    • Testing Instructions:
      Hide

      1. Add a Glossary activity to a course (or use any other form that has both text and editor fields required) and try to enter spaces or line breaks in the required fields. - You should be able to save it. Please note that TinyMCE suppresses the single space by itself, try entering several spaces and line breaks in the editor field.
      2. Go to Site Administration->Security->Site policies and set the checkbox "Strict validation of required fields"
      3. repeat step 1 - spaces are now not allowed
      4. Run tests in lib/simpletest/testformslib.php

      Show
      1. Add a Glossary activity to a course (or use any other form that has both text and editor fields required) and try to enter spaces or line breaks in the required fields. - You should be able to save it. Please note that TinyMCE suppresses the single space by itself, try entering several spaces and line breaks in the editor field. 2. Go to Site Administration->Security->Site policies and set the checkbox "Strict validation of required fields" 3. repeat step 1 - spaces are now not allowed 4. Run tests in lib/simpletest/testformslib.php
    • Affected Branches:
      MOODLE_19_STABLE, MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE
    • Pull Master Branch:
      wip-MDL-19907-master

      Description

      In many of places in where moodle specifies a field ( input text field ) as mandatory, it is accepting "space" as a input and then proceeds without prompting,which results in an anonymous elements into the site or a course

      Steps to reproduce:

      Scenario 1:
      1. create a new course with space as course "full name" and with other details filled.

      Scenario 2 :
      1.Create a new user with some username and password with space as first name and lastname and city

      Actual Results :

      it is accepting "space" as a input and then proceeds without prompting,which results in an anonymous elements into the site or a course.

      Expected results :

      Space should be trimmed if its at the starting of any name or mandatory field, and if its not followed by any other valid characters the usual error highlighting should be done requesting the user to give valid inputs

        Attachments

        1. Course_error.png
          Course_error.png
          60 kB
        2. MDL-19907
          1 kB
        3. MDL-19907_2.patch
          1 kB
        4. testformslib.php
          4 kB
        5. User_create_error.png
          User_create_error.png
          63 kB

          Issue Links

            Activity

              People

              Assignee:
              marina Marina Glancy
              Reporter:
              raviepic3 Ravishankar Somasundaram
              Peer reviewer:
              Andrew Davis
              Integrator:
              Sam Hemelryk
              Tester:
              Michael de Raadt
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Dan Marsden, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              2 Vote for this issue
              Watchers:
              8 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                10/Oct/11