Index: t3lib/class.t3lib_tcemain.php =================================================================== --- t3lib/class.t3lib_tcemain.php (revision 2861) +++ t3lib/class.t3lib_tcemain.php (working copy) @@ -2182,16 +2182,17 @@ $callBackFunc, $structurePath.$key.'/el/'.$ik.'/'.$theKey.'/el/' ); - - // If element is added dynamically in the flexform of TCEforms, we map the ID-string to the next numerical index we can have in that particular section of elements: - // The fact that the order changes is not important since order is controlled by a separately submitted index. - if (substr($ik,0,3)=="ID-") { - $newIndexCounter++; - $this->newIndexMap[$ik] = (is_array($dataValues_current[$key]['el'])&&count($dataValues_current[$key]['el'])?max(array_keys($dataValues_current[$key]['el'])):0)+$newIndexCounter; // Set mapping index - $dataValues[$key]['el'][$this->newIndexMap[$ik]] = $dataValues[$key]['el'][$ik]; // Transfer values - unset($dataValues[$key]['el'][$ik]); // Unset original - } } + + // If element is added dynamically in the flexform of TCEforms, we map the ID-string to the next numerical index we can have in that particular section of elements: + // The fact that the order changes is not important since order is controlled by a separately submitted index. + if (substr($ik,0,3)=="ID-") { + $newIndexCounter++; + $this->newIndexMap[$ik] = (is_array($dataValues_current[$key]['el'])&&count($dataValues_current[$key]['el'])?max(array_keys($dataValues_current[$key]['el'])):0)+$newIndexCounter; // Set mapping index + $dataValues[$key]['el'][$this->newIndexMap[$ik]] = $dataValues[$key]['el'][$ik]; // Transfer values + unset($dataValues[$key]['el'][$ik]); // Unset original + } + } } else { if (!isset($dataValues[$key]['el'])) $dataValues[$key]['el']=array();