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

URL resource trim problem

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 2.5.3
    • 2.5, 2.6
    • Course
    • MOODLE_25_STABLE, MOODLE_26_STABLE
    • MOODLE_25_STABLE
    • wip-MDL-41921-master
    • Hide

      The cause of the problem seems to be, that in mod_url_mod_form (/mod/url/mod_form.php line 54) the 'externalurl' field type is PARAM_URL and when inserting URL with space in end, then it will not be valid URL and the value gets empty.

      When changing the described line as the following:

      -        $mform->setType('externalurl', PARAM_URL);
      +        $mform->setType('externalurl', PARAM_TEXT);
      

      then the form starts to work as expected.
      The URL gets validated anyway in function "validation" in the same file.

      Show
      The cause of the problem seems to be, that in mod_url_mod_form (/mod/url/mod_form.php line 54) the 'externalurl' field type is PARAM_URL and when inserting URL with space in end, then it will not be valid URL and the value gets empty. When changing the described line as the following: - $mform->setType('externalurl', PARAM_URL); + $mform->setType('externalurl', PARAM_TEXT); then the form starts to work as expected. The URL gets validated anyway in function "validation" in the same file.
    • Hide

      Create/edit URL resource and try to enter URLs that are valid or not valid, with or without extra spaces in the beginning/end.
      Try to leave field empty or containing just spaces.

      Make sure that empty (or ' ') URL is not accepted, extra spaces are trimmed.

      Please note that URL validation is very light here.

      Show
      Create/edit URL resource and try to enter URLs that are valid or not valid, with or without extra spaces in the beginning/end. Try to leave field empty or containing just spaces. Make sure that empty (or ' ') URL is not accepted, extra spaces are trimmed. Please note that URL validation is very light here.

      1. Add URL resource to course
      2. Inserting URL that needs trimming to "External URL" field (for example "http://example.com ")
      3. Click "Save and display" or "Save and return..."

      Expected result: trim the "External URL" value and save the resource.

      Actual result: resource not saved, "External URL" field empty and with error "Required".

            marina Marina Glancy
            mangus Mart Mangus
            Ankit Agarwal Ankit Agarwal
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Frédéric Massart Frédéric Massart
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.