Moodle
  1. Moodle
  2. MDL-18539

choosecoursefile form element doesn't work 100% in repeatelements.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Won't Fix
    • Affects Version/s: 1.9.4, 2.0
    • Fix Version/s: None
    • Component/s: Forms Library
    • Labels:
      None
    • Affected Branches:
      MOODLE_19_STABLE, MOODLE_20_STABLE
    • Rank:
      1152

      Description

      what gets returned after the form is submitted looks like this:

      Array (
      [filepath[0]] =>
      [filepath[1]] =>
      [filepath[2]] =>
      )

      rather than
      Array(
      filepath => array
      0 =>
      1 =>
      2 =>
      )
      )

      I guess because the form element appends [value] to the name, so the formname is filepath[0][value]

        Activity

        Hide
        Penny Leach added a comment -

        I changed my validation method to accept $data by reference and put the following in which seems to fix it:

        $data['filepath'] = array();
        foreach (array_keys($data['mediaid']) as $key)

        { $data['filepath'][$key] = $data['filepath[' . $key . ']']; unset($data['filepath[' . $key . ']']); }

        but this should be fixed either in repeat elements or in the form element, not sure which.

        Show
        Penny Leach added a comment - I changed my validation method to accept $data by reference and put the following in which seems to fix it: $data ['filepath'] = array(); foreach (array_keys($data ['mediaid'] ) as $key) { $data['filepath'][$key] = $data['filepath[' . $key . ']']; unset($data['filepath[' . $key . ']']); } but this should be fixed either in repeat elements or in the form element, not sure which.
        Hide
        Michael de Raadt added a comment -

        Thanks for reporting this issue.

        We have detected that this issue has been inactive for over a year. It was reported as affecting versions that are no longer supported.

        If you believe that this issue is still relevant to current versions (2.5 and beyond), please comment on the issue. Issues left inactive for a further month will be closed.

        Michael d.

        TW9vZGxlDQo=

        Show
        Michael de Raadt added a comment - Thanks for reporting this issue. We have detected that this issue has been inactive for over a year. It was reported as affecting versions that are no longer supported. If you believe that this issue is still relevant to current versions (2.5 and beyond), please comment on the issue. Issues left inactive for a further month will be closed. Michael d. TW9vZGxlDQo=
        Hide
        Michael de Raadt added a comment -

        I'm closing this issue as it has been inactive for over a year has been recorded as affecting versions that are no longer supported.

        This is being done as part of a bulk annual clean-up of issues.

        If you still believe this is an issue in supported versions, please create a new issue.

        Show
        Michael de Raadt added a comment - I'm closing this issue as it has been inactive for over a year has been recorded as affecting versions that are no longer supported. This is being done as part of a bulk annual clean-up of issues. If you still believe this is an issue in supported versions, please create a new issue.

          People

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

            Dates

            • Created:
              Updated:
              Resolved: