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

Tricky to set a type on elements within a named group inside repeated elements (backport of MDL-39579)

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.2.9, 2.3.6, 2.4.3
    • Fix Version/s: 2.3.8, 2.4.5
    • Component/s: Forms Library
    • Labels:
    • 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
    • Fixed Branches:
      MOODLE_23_STABLE, MOODLE_24_STABLE
    • Pull from Repository:

      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

              Assignee:
              fred Frédéric Massart
              Reporter:
              poltawski Dan Poltawski
              Peer reviewer:
              Adrian Greeve
              Integrator:
              Marina Glancy
              Tester:
              Jason Fowler
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                8/Jul/13