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

Duration form element does not return the values in the correct format (when used in arrays)

XMLWordPrintable

    • MOODLE_37_STABLE
    • MOODLE_36_STABLE, MOODLE_37_STABLE
    • MDL-67084-master
    • Hide
      1. Upload the attached test file to wwwroot
      2. Open testform.php in the browser
      3. Type something in the form and submit it
      4. Make sure you see the submitted values as nested arrays and the structure of array is the same for text element and duration element
      5. For regression test: create a lesson activity in any course
      6. Change the "Time limit" in the module settings
      7. Save and re-open the module setting form
      8. Make sure the "Time limit" is set to the same value as you set it before
      Show
      Upload the attached test file to wwwroot Open testform.php in the browser Type something in the form and submit it Make sure you see the submitted values as nested arrays and the structure of array is the same for text element and duration element For regression test: create a lesson activity in any course Change the "Time limit" in the module settings Save and re-open the module setting form Make sure the "Time limit" is set to the same value as you set it before

      There is a function _prepareValue() that must be used in form elements exportValue() and it is not always used.

      For example,

              $mform->addElement('text', 'eltext[0]', 'extext');
              $mform->addElement('duration', 'elduration[0]', 'elduration');
      

      Will result in the $data object:

      stdClass Object
      (
          [eltext] => Array
              (
                  [0] => 
              )
       
          [elduration[0]] => 0
          [submitbutton] => Save changes
      )
      

      See the attached testform.php

      We want to use "duration" element inside repeated elements and it gives inconsistent result to the other elements.

      There is also 'modgrade' element that does not call _prepareValue() however it can only be used inside the activity module edit form and it's too complicated to try to fix

            marina Marina Glancy
            marina Marina Glancy
            Daniel Neis Araujo Daniel Neis Araujo
            Jun Pataleta Jun Pataleta
            Janelle Barcega Janelle Barcega
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 hours, 1 minute
                2h 1m

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