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

Tricky to set a type on elements within a named group inside repeated elements

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 2.5
    • 2.2.9, 2.3.6, 2.4.3, 2.5
    • Forms Library
    • None
    • MOODLE_22_STABLE, MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_25_STABLE
    • MOODLE_25_STABLE
    • MDL-39579-master-int
    • Hide

      Focus on groups within repeated elements

      1. Run the Unit Tests
      2. Play with attached file test_form_validation.php
        • Make sure the warnings displayed are expected
        • Make sure the expected warnings are displayed
        • Make sure the submitted values are cleaned properly
      3. Search for groups in repeated elements
        • Make sure they work as expected
      Show
      Focus on groups within repeated elements Run the Unit Tests Play with attached file test_form_validation.php Make sure the warnings displayed are expected Make sure the expected warnings are displayed Make sure the submitted values are cleaned properly Search for groups in repeated elements Make sure they work as expected

      The magic in $mform->repeat_elements() does not allow for the developer to set a type on an element within a (named?) group.

      The following code doesn't work:

                  $group = array(
                      $mform->createElement('text', 'repeatedgroupel1', 'repeatedgroupel1'),
                      $mform->createElement('text', 'repeatedgroupel2', 'repeatedgroupel2'));
                  $repeat = $mform->createElement('group', 'mygroup', 'mygroup', $group);
                  $this->repeat_elements(array($repeat), 2, array('mygroup[repeatedgroupel1]' => array('type' => PARAM_INT)),
                      'repeteablegroup', 'add', 0);
      

            fred Frédéric Massart
            fred Frédéric Massart
            Damyon Wiese Damyon Wiese
            Dan Poltawski Dan Poltawski
            Adrian Greeve Adrian Greeve
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

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