function _initCheckerNestedForms() { $isValid = true; // process nested forms foreach ($this->aInputs as $sKey => $aInput) { if (isset($aInput['type']) && $aInput['type'] != 'files' || !isset($aInput['ghost_template'])) { continue; } if (!(is_array($aInput['ghost_template']) && isset($aInput['ghost_template']['inputs'])) && !(is_object($aInput['ghost_template']) && $aInput['ghost_template'] instanceof BxDolFormNested)) { continue; } $sName = $aInput['name']; $aIds = $this->getSubmittedValue($sName, $this->aFormAttrs['method']); if (!$aIds) { continue; } $aNestedForms = array(); foreach ($aIds as $i => $iFileId) { // create separate form instance for each file $oFormNested = false; if (is_object($aInput['ghost_template'])) { $oFormNested = clone $aInput['ghost_template']; } else { $oFormNested = new BxDolFormNested($aInput['name'], $aInput['ghost_template'], $this->aParams['db']['submit_name'], $this->oTemplate); } $aNestedForms[$iFileId] = $oFormNested; // collect nested form values $aSpecificValues = array(); if (isset($this->aParams['db']['submit_name'])) { $aSpecificValues = array($this->aParams['db']['submit_name'] => 1); } foreach ($oFormNested->aInputs as $r) { $sName = str_replace('[]', '', $r['name']); $aValue = $this->getSubmittedValue($sName, $this->aFormAttrs['method']); $aSpecificValues[$sName] = $aValue[$i]; } $oFormNested->initChecker(array(), $aSpecificValues); // if nested form in invalid - then the whole worm is failed if (!$oFormNested->isValid()) { $isValid = false; } } if ($aNestedForms) { $this->aInputs[$sKey]['ghost_template'] = $aNestedForms; } } return $isValid; }