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

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.2.9, 2.3.6, 2.4.3, 2.5
    • Fix Version/s: 2.5
    • Component/s: Forms Library
    • Labels:
      None
    • Testing Instructions:
      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
    • Affected Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE, MOODLE_24_STABLE, MOODLE_25_STABLE
    • Fixed Branches:
      MOODLE_25_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-39579-master-int

      Description

      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);
      

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  14/May/13