// Extract the random identifier used by the ExtJS tree. This is used later on in the onClick handler
// to dynamically modify the javascript code and instanciate a unique ExtJS tree instance per section.
+ $treeElementIdentifier = '';
if (!empty($flexFormContainerContainerTemplateResult['extJSCODE'])) {
- $treeElementIdentifier = '';
if (preg_match('/StandardTreeItemData\["([a-f0-9]{32})"\]/', $flexFormContainerContainerTemplateResult['extJSCODE'], $matches)) {
$treeElementIdentifier = $matches[1];
}
$uniqueId = StringUtility::getUniqueId('idvar');
$identifierPrefixJs = 'replace(/' . $flexFormFieldIdentifierPrefix . '-/g,"' . $flexFormFieldIdentifierPrefix . '-"+' . $uniqueId . '+"-")';
$identifierPrefixJs .= '.replace(/(tceforms-(datetime|date)field-)/g,"$1" + (new Date()).getTime())';
- $identifierPrefixJs .= '.replace(/(tree_?)?' . $treeElementIdentifier . '/g,"$1" + (' . $uniqueId . '))';
+
+ if (!empty($treeElementIdentifier)) {
+ $identifierPrefixJs .= '.replace(/(tree_?)?' . $treeElementIdentifier . '/g,"$1" + (' . $uniqueId . '))';
+ }
$onClickInsert = array();
$onClickInsert[] = 'var ' . $uniqueId . ' = "' . 'idx"+(new Date()).getTime();';