MDL-31498 formslib: repeat_elements will now set default for group elements
authorRajesh Taneja <rajesh@moodle.com>
Wed, 2 May 2012 05:20:40 +0000 (13:20 +0800)
committerRajesh Taneja <rajesh@moodle.com>
Wed, 2 May 2012 05:20:40 +0000 (13:20 +0800)
lib/formslib.php

index f66b1d7..530a7aa 100644 (file)
@@ -1000,8 +1000,8 @@ abstract class moodleform {
             foreach ($options as $elementname => $elementoptions){
                 $pos=strpos($elementname, '[');
                 if ($pos!==FALSE){
             foreach ($options as $elementname => $elementoptions){
                 $pos=strpos($elementname, '[');
                 if ($pos!==FALSE){
-                    $realelementname = substr($elementname, 0, $pos+1)."[$i]";
-                    $realelementname .= substr($elementname, $pos+1);
+                    $realelementname = substr($elementname, 0, $pos)."[$i]";
+                    $realelementname .= substr($elementname, $pos);
                 }else {
                     $realelementname = $elementname."[$i]";
                 }
                 }else {
                     $realelementname = $elementname."[$i]";
                 }