From 70a4f34d921a9044d5ebbe2a22ca7a0b8e62279a Mon Sep 17 00:00:00 2001
From: Carsten  Rose <carsten.rose@math.uzh.ch>
Date: Wed, 1 Mar 2017 16:35:19 +0100
Subject: [PATCH] Preparation 'DynamicUpdate' fuer beliebige Felder.
 FillStoreForm.php, HelperFormElement.php, BuildFormBootstap.php,
 BuildFormPlain.php, BuildFormTable.php, QuickFormQuery.php: Rename
 buildFormElementId() to buildFormElementname(). New Function
 buildFormElementId(). Rename variable $htmlFormElementId to
 $htmlFormElementName. Support.php: tooltips now contain an html id.
 Constants.php: Preparation for API 'element-update'.

---
 extension/qfq/qfq/AbstractBuildForm.php       | 266 +++++++++---------
 extension/qfq/qfq/BuildFormBootstrap.php      |  10 +-
 extension/qfq/qfq/BuildFormPlain.php          |   4 +-
 extension/qfq/qfq/BuildFormTable.php          |   4 +-
 extension/qfq/qfq/Constants.php               |   4 +
 extension/qfq/qfq/QuickFormQuery.php          |   6 +-
 .../qfq/qfq/helper/HelperFormElement.php      |  21 +-
 extension/qfq/qfq/helper/Support.php          |  31 +-
 extension/qfq/qfq/store/FillStoreForm.php     |   4 +-
 9 files changed, 183 insertions(+), 167 deletions(-)

diff --git a/extension/qfq/qfq/AbstractBuildForm.php b/extension/qfq/qfq/AbstractBuildForm.php
index e6f541ec5..303972969 100644
--- a/extension/qfq/qfq/AbstractBuildForm.php
+++ b/extension/qfq/qfq/AbstractBuildForm.php
@@ -414,14 +414,16 @@ abstract class AbstractBuildForm {
 
             // Typically: $htmlElementNameIdZero = true
             // After Saving a record, staying on the form, the FormElements on the Client are still known as '<feName>:0'.
-            $htmlFormElementId = HelperFormElement::buildFormElementName($formElement[FE_NAME], ($htmlElementNameIdZero) ? 0 : $recordId);
+            $htmlFormElementName = HelperFormElement::buildFormElementName($formElement[FE_NAME], ($htmlElementNameIdZero) ? 0 : $recordId);
+            $formElement[FE_HTML_ID] = HelperFormElement::buildFormElementId($this->formSpec[F_ID], $formElement[FE_ID], ($htmlElementNameIdZero) ? 0 : $recordId, 0);
+
 
             // Construct Marshaller Name: buildElement
             $buildElementFunctionName = 'build' . $this->buildElementFunctionName[$formElement[FE_TYPE]];
 
             $jsonElement = array();
             // Render pure element
-            $elementHtml = $this->$buildElementFunctionName($formElement, $htmlFormElementId, $value, $jsonElement, $mode);
+            $elementHtml = $this->$buildElementFunctionName($formElement, $htmlFormElementName, $value, $jsonElement, $mode);
 
             // container elements do not have dynamicUpdate='yes'. Instead they deliver nested elements.
             if ($formElement[FE_CLASS] == FE_CLASS_CONTAINER) {
@@ -443,13 +445,13 @@ abstract class AbstractBuildForm {
             if ($flagOutput) {
                 // debugStack as Tooltip
                 if ($this->showDebugInfo && count($debugStack) > 0) {
-                    $elementHtml = Support::appendTooltip($elementHtml, implode("\n", $debugStack));
+                    $elementHtml .= Support::doTooltip($formElement[FE_HTML_ID], implode("\n", $debugStack));
                 }
 
                 // Construct Marshaller Name: buildRow
                 $buildRowName = 'buildRow' . $this->buildRowName[$formElement[FE_TYPE]];
 
-                $html .= $formElement[FE_HTML_BEFORE] . $this->$buildRowName($formElement, $elementHtml, $htmlFormElementId) . $formElement[FE_HTML_AFTER];
+                $html .= $formElement[FE_HTML_BEFORE] . $this->$buildRowName($formElement, $elementHtml, $htmlFormElementName) . $formElement[FE_HTML_AFTER];
             }
         }
 
@@ -527,12 +529,12 @@ abstract class AbstractBuildForm {
     /**
      * Builds a real HTML hidden form element. Useful for checkboxes, Multiple-Select and Radios.
      *
-     * @param $htmlFormElementId
+     * @param $htmlFormElementName
      * @param $value
      * @return string
      */
-    public function buildNativeHidden($htmlFormElementId, $value) {
-        return '<input type="hidden" name="' . $htmlFormElementId . '" value="' . htmlentities($value) . '">';
+    public function buildNativeHidden($htmlFormElementName, $value) {
+        return '<input type="hidden" name="' . $htmlFormElementName . '" value="' . htmlentities($value) . '">';
     }
 
     abstract public function tail();
@@ -568,16 +570,16 @@ abstract class AbstractBuildForm {
     /**
      * Create an array with standard elements and add 'form-element', 'value'.
      *
-     * @param $htmlFormElementId
+     * @param $htmlFormElementName
      * @param string|array $value
      * @param string $feMode disabled|readonly|''
      * @return array
      */
-    private function getJsonElementUpdate($htmlFormElementId, $value, $feMode) {
+    private function getJsonElementUpdate($htmlFormElementName, $value, $feMode) {
 
         $json = $this->getJsonFeMode($feMode);
 
-        $json['form-element'] = $htmlFormElementId;
+        $json['form-element'] = $htmlFormElementName;
         $json['value'] = $value;
 
         return $json;
@@ -667,12 +669,12 @@ abstract class AbstractBuildForm {
     /**
      * Builds a label, typically for an html-'<input>'-element.
      *
-     * @param string $htmlFormElementId
+     * @param string $htmlFormElementName
      * @param string $label
      * @return string
      */
-    public function buildLabel($htmlFormElementId, $label) {
-        $attributes = Support::doAttribute('for', $htmlFormElementId);
+    public function buildLabel($htmlFormElementName, $label) {
+        $attributes = Support::doAttribute('for', $htmlFormElementName);
         $attributes .= Support::doAttribute('class', 'control-label');
 
         $html = Support::wrapTag("<label $attributes>", $label);
@@ -682,28 +684,28 @@ abstract class AbstractBuildForm {
 
     /**
      * Builds HTML 'input' element.
-     * Format: <input name="$htmlFormElementId" <type="email|input|password|url" [autocomplete="autocomplete"] [autofocus="autofocus"]
+     * Format: <input name="$htmlFormElementName" <type="email|input|password|url" [autocomplete="autocomplete"] [autofocus="autofocus"]
      *           [maxlength="$maxLength"] [placeholder="$placeholder"] [size="$size"] [min="$min"] [max="$max"]
      *           [pattern="$pattern"] [required="required"] [disabled="disabled"] value="$value">
      *
      *
      * @param array $formElement
-     * @param $htmlFormElementId
+     * @param $htmlFormElementName
      * @param $value
      * @param array $json
      * @param string $mode FORM_LOAD | FORM_UPDATE | FORM_SAVE
      * @return string
      * @throws \qfq\UserFormException
      */
-    public function buildInput(array $formElement, $htmlFormElementId, $value, array &$json, $mode = FORM_LOAD) {
+    public function buildInput(array $formElement, $htmlFormElementName, $value, array &$json, $mode = FORM_LOAD) {
         $textarea = '';
 
-        $attribute = Support::doAttribute('name', $htmlFormElementId);
+        $attribute = Support::doAttribute('name', $htmlFormElementName);
         $attribute .= Support::doAttribute('class', 'form-control');
 
         if (isset($formElement[FE_RETYPE_SOURCE_NAME])) {
-            $htmlFormElementIdPrimary = str_replace(RETYPE_FE_NAME_EXTENSION, '', $htmlFormElementId);
-            $attribute .= Support::doAttribute('data-match', '[name=' . str_replace(':', '\\:', $htmlFormElementIdPrimary) . ']');
+            $htmlFormElementNamePrimary = str_replace(RETYPE_FE_NAME_EXTENSION, '', $htmlFormElementName);
+            $attribute .= Support::doAttribute('data-match', '[name=' . str_replace(':', '\\:', $htmlFormElementNamePrimary) . ']');
         }
 
         // Check for input type 'textarea'
@@ -739,7 +741,7 @@ abstract class AbstractBuildForm {
 
         $attribute .= $this->getAttributeFeMode($formElement[FE_MODE]);
 
-        $json = $this->getJsonElementUpdate($htmlFormElementId, $value, $formElement[FE_MODE]);
+        $json = $this->getJsonElementUpdate($htmlFormElementName, $value, $formElement[FE_MODE]);
 
         return "$htmlTag $attribute>$textarea" . $this->getHelpBlock();
 
@@ -962,12 +964,12 @@ abstract class AbstractBuildForm {
      *
      * Checkboxes will only be submitted, if they are checked. Therefore, a hidden element with the unchecked value will be transferred first.
      *
-     * Format: <input type="hidden" name="$htmlFormElementId" value="$valueUnChecked">
-     *         <input name="$htmlFormElementId" type="checkbox" [autofocus="autofocus"]
+     * Format: <input type="hidden" name="$htmlFormElementName" value="$valueUnChecked">
+     *         <input name="$htmlFormElementName" type="checkbox" [autofocus="autofocus"]
      *            [required="required"] [disabled="disabled"] value="<value>" [checked="checked"] >
      *
      * @param array $formElement
-     * @param $htmlFormElementId
+     * @param $htmlFormElementName
      * @param $value
      * @param array $json
      * @param string $mode FORM_LOAD | FORM_UPDATE | FORM_SAVE*
@@ -975,7 +977,7 @@ abstract class AbstractBuildForm {
      * @throws CodeException
      * @throws \qfq\UserFormException
      */
-    public function buildCheckbox(array $formElement, $htmlFormElementId, $value, array &$json, $mode = FORM_LOAD) {
+    public function buildCheckbox(array $formElement, $htmlFormElementName, $value, array &$json, $mode = FORM_LOAD) {
         $itemKey = array();
         $itemValue = array();
 
@@ -989,7 +991,7 @@ abstract class AbstractBuildForm {
         }
 
         if ($formElement['checkBoxMode'] === 'multi') {
-//            $htmlFormElementId .= '[]';
+
         } else {
             // Fill meaningfull defaults to parameter: checked|unchecked  (CHECKBOX_VALUE_CHECKED|CHECKBOX_VALUE_UNCHECKED)
             $this->prepareCheckboxCheckedUncheckedValue($itemKey, $formElement);
@@ -1001,10 +1003,10 @@ abstract class AbstractBuildForm {
 
         switch ($formElement['checkBoxMode']) {
             case 'single':
-                $html = $this->buildCheckboxSingle($formElement, $htmlFormElementId, $attributeBase, $value, $json);
+                $html = $this->buildCheckboxSingle($formElement, $htmlFormElementName, $attributeBase, $value, $json);
                 break;
             case 'multi';
-                $html = $this->buildCheckboxMulti($formElement, $htmlFormElementId, $attributeBase, $value, $itemKey, $itemValue, $json);
+                $html = $this->buildCheckboxMulti($formElement, $htmlFormElementName, $attributeBase, $value, $itemKey, $itemValue, $json);
                 break;
             default:
                 throw new UserFormException('checkBoxMode: \'' . $formElement['checkBoxMode'] . '\' is unknown.', ERROR_CHECKBOXMODE_UNKNOWN);
@@ -1172,7 +1174,7 @@ abstract class AbstractBuildForm {
      * Build a Checkbox based on two values. Either in HTML plain layout or with Bootstrap Button class.
      *
      * @param array $formElement
-     * @param $htmlFormElementId
+     * @param $htmlFormElementName
      * @param $value
      * @param array $json
      * @param string $mode FORM_LOAD | FORM_UPDATE | FORM_SAVE
@@ -1180,7 +1182,7 @@ abstract class AbstractBuildForm {
      * @throws CodeException
      * @throws \qfq\UserFormException
      */
-    public function buildCheckboxSingle(array $formElement, $htmlFormElementId, $attribute, $value, array &$json, $mode = FORM_LOAD) {
+    public function buildCheckboxSingle(array $formElement, $htmlFormElementName, $attribute, $value, array &$json, $mode = FORM_LOAD) {
 
         if (isset($formElement[FE_BUTTON_CLASS])) {
 
@@ -1188,9 +1190,9 @@ abstract class AbstractBuildForm {
                 $formElement[FE_BUTTON_CLASS] = 'btn-default';
             }
 
-            return $this->constructCheckboxSingleButton($formElement, $htmlFormElementId, $attribute, $value, $json);
+            return $this->constructCheckboxSingleButton($formElement, $htmlFormElementName, $attribute, $value, $json);
         } else {
-            return $this->constructCheckboxSinglePlain($formElement, $htmlFormElementId, $attribute, $value, $json);
+            return $this->constructCheckboxSinglePlain($formElement, $htmlFormElementName, $attribute, $value, $json);
         }
     }
 
@@ -1198,24 +1200,24 @@ abstract class AbstractBuildForm {
      * Build a Checkbox based on two values with Bootstrap Button class.
      *
      * <div class="btn-group" data-toggle="buttons">
-     *    <input type="hidden" name="$htmlFormElementId" value="$valueUnChecked">
+     *    <input type="hidden" name="$htmlFormElementName" value="$valueUnChecked">
      *    <label class="btn btn-primary active">
-     *       <input type="checkbox" autocomplete="off" name="$htmlFormElementId" value="$valueChecked"checked> Checkbox 1 (pre-checked)
+     *       <input type="checkbox" autocomplete="off" name="$htmlFormElementName" value="$valueChecked"checked> Checkbox 1 (pre-checked)
      *    </label>
      * </div>
      *
      * @param array $formElement
-     * @param $htmlFormElementId
+     * @param $htmlFormElementName
      * @param $attribute
      * @param $value
      * @param array $json
      * @return string
      */
-    public function constructCheckboxSingleButton(array $formElement, $htmlFormElementId, $attribute, $value, array &$json) {
+    public function constructCheckboxSingleButton(array $formElement, $htmlFormElementName, $attribute, $value, array &$json) {
         $html = '';
         $valueJson = false;
 
-        $attribute .= Support::doAttribute('name', $htmlFormElementId);
+        $attribute .= Support::doAttribute('name', $htmlFormElementName);
         $attribute .= Support::doAttribute('value', $formElement['checked'], false);
         $attribute .= Support::doAttribute('title', $formElement['tooltip']);
         $attribute .= Support::doAttribute('data-load', ($formElement[FE_DYNAMIC_UPDATE] === 'yes') ? 'data-load' : '');
@@ -1231,7 +1233,7 @@ abstract class AbstractBuildForm {
         $attribute .= $this->getAttributeList($formElement, ['autofocus']);
         $attribute .= $this->getAttributeList($formElement, [F_FE_DATA_PATTERN_ERROR, F_FE_DATA_REQUIRED_ERROR, F_FE_DATA_MATCH_ERROR, F_FE_DATA_ERROR]);
 
-        $html = $this->buildNativeHidden($htmlFormElementId, $formElement['unchecked']);
+        $html = $this->buildNativeHidden($htmlFormElementName, $formElement['unchecked']);
 
         $htmlElement = '<input ' . $attribute . '>';
         if (isset($formElement['label2'])) {
@@ -1244,7 +1246,7 @@ abstract class AbstractBuildForm {
             $htmlElement, true);
         $html = Support::wrapTag('<div class="btn-group" data-toggle="buttons">', $html);
 
-        $json = $this->getJsonElementUpdate($htmlFormElementId, $valueJson, $formElement[FE_MODE]);
+        $json = $this->getJsonElementUpdate($htmlFormElementName, $valueJson, $formElement[FE_MODE]);
 
         return $html;
     }
@@ -1254,22 +1256,22 @@ abstract class AbstractBuildForm {
      * Create a 'hidden' input field and a 'checkbox' input field - both with the same HTML 'name'.
      * HTML does not submit an unchecked checkbox. Then only the 'hidden' input field is submitted.
      *
-     * Format: <input type="hidden" name="$htmlFormElementId" value="$valueUnChecked">
-     *         <input name="$htmlFormElementId" type="radio" [autofocus="autofocus"]
+     * Format: <input type="hidden" name="$htmlFormElementName" value="$valueUnChecked">
+     *         <input name="$htmlFormElementName" type="radio" [autofocus="autofocus"]
      *            [required="required"] [disabled="disabled"] value="<value>" [checked="checked"] >
      *
      * @param array $formElement
-     * @param $htmlFormElementId
+     * @param $htmlFormElementName
      * @param $attribute
      * @param $value
      * @param array $json
      * @return string
      */
-    public function constructCheckboxSinglePlain(array $formElement, $htmlFormElementId, $attribute, $value, array &$json) {
+    public function constructCheckboxSinglePlain(array $formElement, $htmlFormElementName, $attribute, $value, array &$json) {
         $html = '';
         $valueJson = false;
 
-        $attribute .= Support::doAttribute('name', $htmlFormElementId);
+        $attribute .= Support::doAttribute('name', $htmlFormElementName);
         $attribute .= Support::doAttribute('value', $formElement['checked'], false);
         $attribute .= Support::doAttribute('title', $formElement['tooltip']);
         $attribute .= Support::doAttribute('data-load', ($formElement[FE_DYNAMIC_UPDATE] === 'yes') ? 'data-load' : '');
@@ -1282,7 +1284,7 @@ abstract class AbstractBuildForm {
         $attribute .= $this->getAttributeList($formElement, ['autofocus']);
         $attribute .= $this->getAttributeList($formElement, [F_FE_DATA_PATTERN_ERROR, F_FE_DATA_REQUIRED_ERROR, F_FE_DATA_MATCH_ERROR, F_FE_DATA_ERROR]);
 
-        $html = $this->buildNativeHidden($htmlFormElementId, $formElement['unchecked']);
+        $html = $this->buildNativeHidden($htmlFormElementName, $formElement['unchecked']);
 
         $html .= '<input ' . $attribute . '>';
         if (isset($formElement['label2'])) {
@@ -1292,7 +1294,7 @@ abstract class AbstractBuildForm {
         $html = Support::wrapTag("<label>", $html, true);
         $html = Support::wrapTag("<div class='checkbox'>", $html, true);
 
-        $json = $this->getJsonElementUpdate($htmlFormElementId, $valueJson, $formElement[FE_MODE]);
+        $json = $this->getJsonElementUpdate($htmlFormElementName, $valueJson, $formElement[FE_MODE]);
 
         return $html;
     }
@@ -1301,7 +1303,7 @@ abstract class AbstractBuildForm {
      * Build a Checkbox based on two values. Either in HTML plain layout or with Bootstrap Button class.
      *
      * @param array $formElement
-     * @param $htmlFormElementId
+     * @param $htmlFormElementName
      * @param $value
      * @param array $json
      * @param string $mode FORM_LOAD | FORM_UPDATE | FORM_SAVE
@@ -1309,7 +1311,7 @@ abstract class AbstractBuildForm {
      * @throws CodeException
      * @throws \qfq\UserFormException
      */
-    public function buildCheckboxMulti(array $formElement, $htmlFormElementId, $attributeBase, $value, array $itemKey, array $itemValue, array &$json) {
+    public function buildCheckboxMulti(array $formElement, $htmlFormElementName, $attributeBase, $value, array $itemKey, array $itemValue, array &$json) {
 
         if (isset($formElement[FE_BUTTON_CLASS])) {
 
@@ -1317,9 +1319,9 @@ abstract class AbstractBuildForm {
                 $formElement[FE_BUTTON_CLASS] = 'btn-default';
             }
 
-            return $this->constructCheckboxMultiButton($formElement, $htmlFormElementId, $attributeBase, $value, $itemKey, $itemValue, $json);
+            return $this->constructCheckboxMultiButton($formElement, $htmlFormElementName, $attributeBase, $value, $itemKey, $itemValue, $json);
         } else {
-            return $this->constructCheckboxMultiPlain($formElement, $htmlFormElementId, $attributeBase, $value, $itemKey, $itemValue, $json);
+            return $this->constructCheckboxMultiPlain($formElement, $htmlFormElementName, $attributeBase, $value, $itemKey, $itemValue, $json);
         }
     }
 
@@ -1330,7 +1332,7 @@ abstract class AbstractBuildForm {
      *         depending of if they aligned horizontal or vertical.
      *
      * @param array $formElement
-     * @param $htmlFormElementId
+     * @param $htmlFormElementName
      * @param $attributeBase
      * @param $value
      * @param array $itemKey
@@ -1338,17 +1340,16 @@ abstract class AbstractBuildForm {
      * @param array $json
      * @return string
      */
-    public function constructCheckboxMultiButton(array $formElement, $htmlFormElementId, $attributeBase, $value, array $itemKey, array $itemValue, array &$json) {
+    public function constructCheckboxMultiButton(array $formElement, $htmlFormElementName, $attributeBase, $value, array $itemKey, array $itemValue, array &$json) {
         $json = array();
 
         // Defines which of the checkboxes will be checked.
         $values = explode(',', $value);
 
-//        $attributeBase .= Support::doAttribute('name', $htmlFormElementId);
         $attributeBase .= Support::doAttribute('data-load', ($formElement[FE_DYNAMIC_UPDATE] === 'yes') ? 'data-load' : '');
         $attributeBase .= $this->getAttributeList($formElement, [F_FE_DATA_PATTERN_ERROR, F_FE_DATA_REQUIRED_ERROR, F_FE_DATA_MATCH_ERROR, F_FE_DATA_ERROR]);
 
-        $html = $this->buildNativeHidden(HelperFormElement::prependFormElementIdCheckBoxMulti($htmlFormElementId, 'h'), '');
+        $html = $this->buildNativeHidden(HelperFormElement::prependFormElementNameCheckBoxMulti($htmlFormElementName, 'h'), '');
 
         $attribute = $attributeBase;
         if (isset($formElement['autofocus'])) {
@@ -1358,8 +1359,8 @@ abstract class AbstractBuildForm {
         for ($ii = 0, $jj = 1; $ii < count($itemKey); $ii++, $jj++) {
             $jsonValue = false;
             $classActive = '';
-            $htmlFormElementIdUniq = HelperFormElement::prependFormElementIdCheckBoxMulti($htmlFormElementId, $ii);
-            $attribute .= Support::doAttribute('name', $htmlFormElementIdUniq);
+            $htmlFormElementNameUniq = HelperFormElement::prependFormElementNameCheckBoxMulti($htmlFormElementName, $ii);
+            $attribute .= Support::doAttribute('name', $htmlFormElementNameUniq);
 
             $attribute .= Support::doAttribute('value', $itemKey[$ii]);
 
@@ -1378,7 +1379,7 @@ abstract class AbstractBuildForm {
             $html .= Support::wrapTag("<label class='btn " . $formElement[FE_BUTTON_CLASS] . "$classActive'>",
                 $htmlElement, true);
 
-            $json[] = $this->getJsonElementUpdate($htmlFormElementIdUniq, $jsonValue, $formElement[FE_MODE]);
+            $json[] = $this->getJsonElementUpdate($htmlFormElementNameUniq, $jsonValue, $formElement[FE_MODE]);
 
             // Init for the next checkbox
             $attribute = $attributeBase;
@@ -1396,7 +1397,7 @@ abstract class AbstractBuildForm {
      *         depending of if they aligned horizontal or vertical.
      *
      * @param array $formElement
-     * @param $htmlFormElementId
+     * @param $htmlFormElementName
      * @param $attributeBase
      * @param $value
      * @param array $itemKey
@@ -1404,17 +1405,16 @@ abstract class AbstractBuildForm {
      * @param array $json
      * @return string
      */
-    public function constructCheckboxMultiPlain(array $formElement, $htmlFormElementId, $attributeBase, $value, array $itemKey, array $itemValue, array &$json) {
+    public function constructCheckboxMultiPlain(array $formElement, $htmlFormElementName, $attributeBase, $value, array $itemKey, array $itemValue, array &$json) {
         $json = array();
 
         // Defines which of the checkboxes will be checked.
         $values = explode(',', $value);
 
-//        $attributeBase .= Support::doAttribute('name', $htmlFormElementId);
         $attributeBase .= Support::doAttribute('data-load', ($formElement[FE_DYNAMIC_UPDATE] === 'yes') ? 'data-load' : '');
         $attributeBase .= $this->getAttributeList($formElement, [F_FE_DATA_PATTERN_ERROR, F_FE_DATA_REQUIRED_ERROR, F_FE_DATA_MATCH_ERROR, F_FE_DATA_ERROR]);
 
-        $html = $this->buildNativeHidden(HelperFormElement::prependFormElementIdCheckBoxMulti($htmlFormElementId, 'h'), '');
+        $html = $this->buildNativeHidden(HelperFormElement::prependFormElementNameCheckBoxMulti($htmlFormElementName, 'h'), '');
 
         $orientation = ($formElement['maxLength'] > 1) ? ALIGN_HORIZONTAL : ALIGN_VERTICAL;
         $checkboxClass = ($orientation === ALIGN_HORIZONTAL) ? 'checkbox-inline' : 'checkbox';
@@ -1424,8 +1424,8 @@ abstract class AbstractBuildForm {
         for ($ii = 0, $jj = 1; $ii < count($itemKey); $ii++, $jj++) {
             $jsonValue = false;
             $attribute = $attributeBase;
-            $htmlFormElementIdUniq = HelperFormElement::prependFormElementIdCheckBoxMulti($htmlFormElementId, $ii);
-            $attribute .= Support::doAttribute('name', $htmlFormElementIdUniq);
+            $htmlFormElementNameUniq = HelperFormElement::prependFormElementNameCheckBoxMulti($htmlFormElementName, $ii);
+            $attribute .= Support::doAttribute('name', $htmlFormElementNameUniq);
 
             // Do this only the first round.
             if ($flagFirst) {
@@ -1466,7 +1466,7 @@ abstract class AbstractBuildForm {
             }
 
             $html .= $htmlElement . $br;
-            $json[] = $this->getJsonElementUpdate($htmlFormElementIdUniq, $jsonValue, $formElement[FE_MODE]);
+            $json[] = $this->getJsonElementUpdate($htmlFormElementNameUniq, $jsonValue, $formElement[FE_MODE]);
 
         }
 
@@ -1480,7 +1480,7 @@ abstract class AbstractBuildForm {
      * To avoid any manipulation on those fields, the values will be transferred by SIP.
      *
      * @param array $formElement
-     * @param $htmlFormElementId
+     * @param $htmlFormElementName
      * @param $value
      * @param array $json
      * @param string $mode FORM_LOAD | FORM_UPDATE | FORM_SAVE
@@ -1488,11 +1488,11 @@ abstract class AbstractBuildForm {
      * @throws CodeException
      * @throws \qfq\UserFormException
      */
-    public function buildExtra(array $formElement, $htmlFormElementId, $value, array &$json, $mode = FORM_LOAD) {
+    public function buildExtra(array $formElement, $htmlFormElementName, $value, array &$json, $mode = FORM_LOAD) {
 
         if ($mode === FORM_LOAD) {
             // Split 'grId:0' in 'grId' and '0'
-            $name = explode(':', $htmlFormElementId, 2);
+            $name = explode(':', $htmlFormElementName, 2);
 
             $this->store->setVar($name[0], $value, STORE_SIP, false);
         }
@@ -1501,12 +1501,12 @@ abstract class AbstractBuildForm {
     /**
      * Build HTML 'radio' element.
      *
-     * Format: <input type="hidden" name="$htmlFormElementId" value="$valueUnChecked">
-     *         <input name="$htmlFormElementId" type="radio" [autofocus="autofocus"]
+     * Format: <input type="hidden" name="$htmlFormElementName" value="$valueUnChecked">
+     *         <input name="$htmlFormElementName" type="radio" [autofocus="autofocus"]
      *            [required="required"] [disabled="disabled"] value="<value>" [checked="checked"] >
      *
      * @param array $formElement
-     * @param $htmlFormElementId
+     * @param $htmlFormElementName
      * @param $value
      * @param array $json
      * @param string $mode FORM_LOAD | FORM_UPDATE | FORM_SAVE
@@ -1514,7 +1514,7 @@ abstract class AbstractBuildForm {
      * @throws CodeException
      * @throws \qfq\UserFormException
      */
-    public function buildRadio(array $formElement, $htmlFormElementId, $value, array &$json, $mode = FORM_LOAD) {
+    public function buildRadio(array $formElement, $htmlFormElementName, $value, array &$json, $mode = FORM_LOAD) {
 
         if (isset($formElement[FE_BUTTON_CLASS])) {
 
@@ -1522,9 +1522,9 @@ abstract class AbstractBuildForm {
                 $formElement[FE_BUTTON_CLASS] = 'btn-default';
             }
 
-            $html = $this->constructRadioButton($formElement, $htmlFormElementId, $value, $json, $mode);
+            $html = $this->constructRadioButton($formElement, $htmlFormElementName, $value, $json, $mode);
         } else {
-            $html = $this->constructRadioPlain($formElement, $htmlFormElementId, $value, $json, $mode);
+            $html = $this->constructRadioPlain($formElement, $htmlFormElementName, $value, $json, $mode);
         }
 
         return $html . $this->getHelpBlock();
@@ -1550,7 +1550,7 @@ abstract class AbstractBuildForm {
      * </div>
      *
      * @param array $formElement
-     * @param $htmlFormElementId
+     * @param $htmlFormElementName
      * @param $value
      * @param array $json
      * @param string $mode FORM_LOAD | FORM_UPDATE | FORM_SAVE
@@ -1558,7 +1558,7 @@ abstract class AbstractBuildForm {
      * @throws CodeException
      * @throws \qfq\UserFormException
      */
-    private function constructRadioButton(array $formElement, $htmlFormElementId, $value, array &$json, $mode = FORM_LOAD) {
+    private function constructRadioButton(array $formElement, $htmlFormElementName, $value, array &$json, $mode = FORM_LOAD) {
         $itemKey = array();
         $itemValue = array();
 
@@ -1567,7 +1567,7 @@ abstract class AbstractBuildForm {
 
         $attributeBase = $this->getAttributeFeMode($formElement[FE_MODE]);
         $attributeBase .= $this->getAttributeList($formElement, [F_FE_DATA_PATTERN_ERROR, F_FE_DATA_REQUIRED_ERROR, F_FE_DATA_MATCH_ERROR, F_FE_DATA_ERROR]);
-        $attributeBase .= Support::doAttribute('name', $htmlFormElementId);
+        $attributeBase .= Support::doAttribute('name', $htmlFormElementName);
         $attributeBase .= Support::doAttribute('type', $formElement[FE_TYPE]);
         $attributeBase .= Support::doAttribute('data-load', ($formElement[FE_DYNAMIC_UPDATE] === 'yes') ? 'data-load' : '');
         $attributeBase .= Support::doAttribute('autocomplete', 'off');
@@ -1577,7 +1577,7 @@ abstract class AbstractBuildForm {
             $attribute .= Support::doAttribute('autofocus', $formElement['autofocus']);
         }
 
-        $html = $this->buildNativeHidden($htmlFormElementId, $value);
+        $html = $this->buildNativeHidden($htmlFormElementName, $value);
 
         for ($ii = 0; $ii < count($itemValue); $ii++) {
             $classActive = '';
@@ -1602,7 +1602,7 @@ abstract class AbstractBuildForm {
 
         $html = Support::wrapTag('<div class="btn-group" data-toggle="buttons">', $html);
 
-        $json = $this->getJsonElementUpdate($htmlFormElementId, $value, $formElement[FE_MODE]);
+        $json = $this->getJsonElementUpdate($htmlFormElementName, $value, $formElement[FE_MODE]);
 
         return $html;
     }
@@ -1610,12 +1610,12 @@ abstract class AbstractBuildForm {
     /**
      * Build plain HTML 'radio' element.
      *
-     * Format: <input type="hidden" name="$htmlFormElementId" value="$valueUnChecked">
-     *         <input name="$htmlFormElementId" type="radio" [autofocus="autofocus"]
+     * Format: <input type="hidden" name="$htmlFormElementName" value="$valueUnChecked">
+     *         <input name="$htmlFormElementName" type="radio" [autofocus="autofocus"]
      *            [required="required"] [disabled="disabled"] value="<value>" [checked="checked"] >
      *
      * @param array $formElement
-     * @param $htmlFormElementId
+     * @param $htmlFormElementName
      * @param $value
      * @param array $json
      * @param string $mode FORM_LOAD | FORM_UPDATE | FORM_SAVE
@@ -1623,10 +1623,10 @@ abstract class AbstractBuildForm {
      * @throws CodeException
      * @throws \qfq\UserFormException
      */
-    private function constructRadioPlain(array $formElement, $htmlFormElementId, $value, array &$json, $mode = FORM_LOAD) {
+    private function constructRadioPlain(array $formElement, $htmlFormElementName, $value, array &$json, $mode = FORM_LOAD) {
 
         if (isset($formElement[FE_BUTTON_CLASS])) {
-            return $this->constructRadioButton($formElement, $htmlFormElementId, $value, $json, $mode);
+            return $this->constructRadioButton($formElement, $htmlFormElementName, $value, $json, $mode);
         }
 
 
@@ -1638,7 +1638,7 @@ abstract class AbstractBuildForm {
 
         $attributeBase = $this->getAttributeFeMode($formElement[FE_MODE]);
         $attributeBase .= $this->getAttributeList($formElement, [F_FE_DATA_PATTERN_ERROR, F_FE_DATA_REQUIRED_ERROR, F_FE_DATA_MATCH_ERROR, F_FE_DATA_ERROR]);
-        $attributeBase .= Support::doAttribute('name', $htmlFormElementId);
+        $attributeBase .= Support::doAttribute('name', $htmlFormElementName);
         $attributeBase .= Support::doAttribute('type', $formElement[FE_TYPE]);
         $attributeBase .= Support::doAttribute('data-load', ($formElement[FE_DYNAMIC_UPDATE] === 'yes') ? 'data-load' : '');
 
@@ -1653,7 +1653,7 @@ abstract class AbstractBuildForm {
             $attribute .= Support::doAttribute('autofocus', $formElement['autofocus']);
         }
 
-        $html = $this->buildNativeHidden($htmlFormElementId, $value);
+        $html = $this->buildNativeHidden($htmlFormElementName, $value);
 
         for ($ii = 0; $ii < count($itemValue); $ii++) {
             $jj++;
@@ -1692,7 +1692,7 @@ abstract class AbstractBuildForm {
             $attribute = $attributeBase;
         }
 
-        $json = $this->getJsonElementUpdate($htmlFormElementId, $value, $formElement[FE_MODE]);
+        $json = $this->getJsonElementUpdate($htmlFormElementName, $value, $formElement[FE_MODE]);
 
         return $html;
     }
@@ -1701,7 +1701,7 @@ abstract class AbstractBuildForm {
      * Builds a Selct (Dropdown) Box.
      *
      * @param array $formElement
-     * @param $htmlFormElementId
+     * @param $htmlFormElementName
      * @param $value
      * @param array $json
      * @param string $mode FORM_LOAD | FORM_UPDATE | FORM_SAVE
@@ -1709,7 +1709,7 @@ abstract class AbstractBuildForm {
      * @throws CodeException
      * @throws \qfq\UserFormException
      */
-    public function buildSelect(array $formElement, $htmlFormElementId, $value, array &$json, $mode = FORM_LOAD) {
+    public function buildSelect(array $formElement, $htmlFormElementName, $value, array &$json, $mode = FORM_LOAD) {
         $itemKey = array();
         $itemValue = array();
 
@@ -1717,7 +1717,7 @@ abstract class AbstractBuildForm {
         $this->getKeyValueListFromSqlEnumSpec($formElement, $itemKey, $itemValue);
 
         $attribute = $this->getAttributeFeMode($formElement[FE_MODE]);
-        $attribute .= Support::doAttribute('name', $htmlFormElementId);
+        $attribute .= Support::doAttribute('name', $htmlFormElementName);
         $attribute .= Support::doAttribute('class', 'form-control');
         $attribute .= Support::doAttribute('title', $formElement['tooltip']);
         $attribute .= $this->getAttributeList($formElement, ['autofocus']);
@@ -1751,7 +1751,7 @@ abstract class AbstractBuildForm {
             $option .= '>' . $itemValue[$ii] . '</option>';
         }
 
-        $json = $this->getJsonElementUpdate($htmlFormElementId, $jsonValues, $formElement[FE_MODE]);
+        $json = $this->getJsonElementUpdate($htmlFormElementName, $jsonValues, $formElement[FE_MODE]);
 
         return '<select ' . $attribute . '>' . $option . '</select>' . $this->getHelpBlock();
     }
@@ -1761,7 +1761,7 @@ abstract class AbstractBuildForm {
      * Column syntax definition: https://wikiit.math.uzh.ch/it/projekt/qfq/qfq-jqwidgets/Documentation#Type:_subrecord
      *
      * @param array $formElement
-     * @param $htmlFormElementId
+     * @param $htmlFormElementName
      * @param $value
      * @param array $json
      * @param string $mode FORM_LOAD | FORM_UPDATE | FORM_SAVE
@@ -1769,7 +1769,7 @@ abstract class AbstractBuildForm {
      * @throws CodeException
      * @throws \qfq\UserFormException
      */
-    public function buildSubrecord(array $formElement, $htmlFormElementId, $value, array &$json, $mode = FORM_LOAD) {
+    public function buildSubrecord(array $formElement, $htmlFormElementName, $value, array &$json, $mode = FORM_LOAD) {
         $rcText = false;
         $nameColumnId = 'id';
         $targetTableName = '';
@@ -2164,7 +2164,7 @@ abstract class AbstractBuildForm {
      * Build an Upload (File) Button.
      *
      * @param array $formElement
-     * @param $htmlFormElementId
+     * @param $htmlFormElementName
      * @param $value
      * @param array $json
      * @param string $mode FORM_LOAD | FORM_UPDATE | FORM_SAVE
@@ -2172,7 +2172,7 @@ abstract class AbstractBuildForm {
      * @throws CodeException
      * @throws \qfq\UserFormException
      */
-    public function buildFile(array $formElement, $htmlFormElementId, $value, array &$json, $mode = FORM_LOAD) {
+    public function buildFile(array $formElement, $htmlFormElementName, $value, array &$json, $mode = FORM_LOAD) {
         $attribute = '';
 
         # Build param array for uniq SIP
@@ -2186,9 +2186,9 @@ abstract class AbstractBuildForm {
         $arr[EXISTING_PATH_FILE_NAME] = $value;
         $sipUpload = $this->sip->queryStringToSip(OnArray::toString($arr), RETURN_SIP);
 
-        $hiddenSipUpload = $this->buildNativeHidden($htmlFormElementId, $sipUpload);
+        $hiddenSipUpload = $this->buildNativeHidden($htmlFormElementName, $sipUpload);
 
-        $attribute .= Support::doAttribute('name', $htmlFormElementId);
+        $attribute .= Support::doAttribute('name', $htmlFormElementName);
 //        $attribute .= Support::doAttribute('class', 'form-control');
         $attribute .= Support::doAttribute('type', 'file');
         $attribute .= Support::doAttribute('title', $formElement['tooltip']);
@@ -2209,36 +2209,36 @@ abstract class AbstractBuildForm {
         $attribute .= Support::doAttribute('class', $uploadClass, true);
         $htmlInputFile = '<input ' . $attribute . '>' . $this->getHelpBlock();
 
-        $deleteButton = Support::wrapTag("<button type='button' class='delete-file' data-sip='$sipUpload' name='delete-$htmlFormElementId'>", $this->symbol[SYMBOL_DELETE]);
+        $deleteButton = Support::wrapTag("<button type='button' class='delete-file' data-sip='$sipUpload' name='delete-$htmlFormElementName'>", $this->symbol[SYMBOL_DELETE]);
 
         $htmlFilename = Support::wrapTag("<span class='uploaded-file-name'>", $value, false);
         $htmlTextDelete = Support::wrapTag("<div class='uploaded-file $textDeleteClass'>", $htmlFilename . ' ' . $deleteButton);
 
 //        <button type="button" class="file-delete" data-sip="571d1fc9e6974"><span class="glyphicon glyphicon-trash"></span></button>
 
-        $json = $this->getJsonElementUpdate($htmlFormElementId, $value, $formElement[FE_MODE]);
+        $json = $this->getJsonElementUpdate($htmlFormElementName, $value, $formElement[FE_MODE]);
 
         return $htmlTextDelete . $htmlInputFile . $hiddenSipUpload;
     }
 
     /**
      * Builds HTML 'input' element.
-     * Format: <input name="$htmlFormElementId" <type="date" [autocomplete="autocomplete"] [autofocus="autofocus"]
+     * Format: <input name="$htmlFormElementName" <type="date" [autocomplete="autocomplete"] [autofocus="autofocus"]
      *           [maxlength="$maxLength"] [placeholder="$placeholder"] [size="$size"] [min="$min"] [max="$max"]
      *           [pattern="$pattern"] [required="required"] [disabled="disabled"] value="$value">
      *
      *
      * @param array $formElement
-     * @param $htmlFormElementId
+     * @param $htmlFormElementName
      * @param $value
      * @param array $json
      * @param string $mode FORM_LOAD | FORM_UPDATE | FORM_SAVE
      * @return string
      * @throws UserFormException
      */
-    public function buildDateTime(array $formElement, $htmlFormElementId, $value, array &$json, $mode = FORM_LOAD) {
+    public function buildDateTime(array $formElement, $htmlFormElementName, $value, array &$json, $mode = FORM_LOAD) {
 
-        $attribute = Support::doAttribute('name', $htmlFormElementId);
+        $attribute = Support::doAttribute('name', $htmlFormElementName);
         $attribute .= Support::doAttribute('class', 'form-control');
 
         $arrMinMax = null;
@@ -2317,7 +2317,7 @@ abstract class AbstractBuildForm {
 
         $attribute .= $this->getAttributeFeMode($formElement[FE_MODE]);
 
-        $json = $this->getJsonElementUpdate($htmlFormElementId, $value, $formElement[FE_MODE]);
+        $json = $this->getJsonElementUpdate($htmlFormElementName, $value, $formElement[FE_MODE]);
 
         return "<input $attribute>" . $this->getHelpBlock();
 
@@ -2325,20 +2325,20 @@ abstract class AbstractBuildForm {
 
     /**
      * Builds HTML 'input' element.
-     * Format: <input name="$htmlFormElementId" <type="date" [autocomplete="autocomplete"] [autofocus="autofocus"]
+     * Format: <input name="$htmlFormElementName" <type="date" [autocomplete="autocomplete"] [autofocus="autofocus"]
      *           [maxlength="$maxLength"] [placeholder="$placeholder"] [size="$size"] [min="$min"] [max="$max"]
      *           [pattern="$pattern"] [required="required"] [disabled="disabled"] value="$value">
      *
      *
      * @param array $formElement
-     * @param $htmlFormElementId
+     * @param $htmlFormElementName
      * @param $value
      * @param array $json
      * @param string $mode FORM_LOAD | FORM_UPDATE | FORM_SAVE
      * @return string
      * @throws UserFormException
      */
-    public function buildDateJQW(array $formElement, $htmlFormElementId, $value, array &$json, $mode = FORM_LOAD) {
+    public function buildDateJQW(array $formElement, $htmlFormElementName, $value, array &$json, $mode = FORM_LOAD) {
         $arrMinMax = null;
 
 //        if ($formElement['placeholder'] == '') {
@@ -2384,9 +2384,9 @@ abstract class AbstractBuildForm {
 
 //        $formElement[FE_DATE_FORMAT]
 
-        $attribute = Support::doAttribute('id', $htmlFormElementId);
+        $attribute = Support::doAttribute('id', $htmlFormElementName);
         $attribute .= Support::doAttribute('class', 'jqw-datetimepicker');
-        $attribute .= Support::doAttribute('data-control-name', "$htmlFormElementId");
+        $attribute .= Support::doAttribute('data-control-name', "$htmlFormElementName");
         $attribute .= Support::doAttribute('data-format-string', "dd.MM.yyyy HH:mm");
         $attribute .= Support::doAttribute('data-show-time-button', "true");
 //        $attribute .= Support::doAttribute('data-placeholder', $formElement['placeholder']);
@@ -2402,7 +2402,7 @@ abstract class AbstractBuildForm {
 
         $attribute .= $this->getAttributeFeMode($formElement[FE_MODE]);
 
-//        $json = $this->getJsonElementUpdate($htmlFormElementId, $value, $formElement[FE_MODE]);
+//        $json = $this->getJsonElementUpdate($htmlFormElementName, $value, $formElement[FE_MODE]);
 
         $element = Support::wrapTag("<div $attribute>", '', false);
 
@@ -2414,30 +2414,30 @@ abstract class AbstractBuildForm {
      * List of possible plugins: https://www.tinymce.com/docs/plugins/
      *
      * @param array $formElement
-     * @param $htmlFormElementId
+     * @param $htmlFormElementName
      * @param $value
      * @param array $json
      * @param string $mode
      * @return string
      * @throws \qfq\UserFormException
      */
-    public function buildEditor(array $formElement, $htmlFormElementId, $value, array &$json, $mode = FORM_LOAD) {
+    public function buildEditor(array $formElement, $htmlFormElementName, $value, array &$json, $mode = FORM_LOAD) {
 
         //TODO plugin autoresize nutzen um Editorgroesse anzugeben
 
         $this->adjustMaxLength($formElement);
 
-        $attribute = Support::doAttribute('name', $htmlFormElementId);
-        $attribute .= Support::doAttribute('id', $htmlFormElementId);
+        $attribute = Support::doAttribute('name', $htmlFormElementName);
+        $attribute .= Support::doAttribute('id', $htmlFormElementName);
 
         $attribute .= Support::doAttribute('class', 'qfq-tinymce');
-        $attribute .= Support::doAttribute('data-control-name', "$htmlFormElementId");
+        $attribute .= Support::doAttribute('data-control-name', "$htmlFormElementName");
         $attribute .= Support::doAttribute('data-placeholder', $formElement['placeholder']);
 //        $attribute .= Support::doAttribute('data-autofocus', $formElement['autofocus']);
         $attribute .= Support::doAttribute('data-load', ($formElement[FE_DYNAMIC_UPDATE] === 'yes') ? 'data-load' : '');
         $attribute .= Support::doAttribute('data-title', $formElement['tooltip']);
 
-        $formElement = $this->setEditorConfig($formElement, $htmlFormElementId);
+        $formElement = $this->setEditorConfig($formElement, $htmlFormElementName);
         // $formElement['editor-plugins']='autoresize code'
         // $formElement['editor-contextmenu']='link image | cell row column'
         $json = $this->getPrefixedElementsAsJSON(FE_EDITOR_PREFIX, $formElement);
@@ -2447,7 +2447,7 @@ abstract class AbstractBuildForm {
         $attribute .= $this->getAttributeFeMode($formElement[FE_MODE]);
         $attribute .= $this->getAttributeList($formElement, [F_FE_DATA_PATTERN_ERROR, F_FE_DATA_REQUIRED_ERROR, F_FE_DATA_MATCH_ERROR, F_FE_DATA_ERROR]);
 
-        $json = $this->getJsonElementUpdate($htmlFormElementId, $value, $formElement[FE_MODE]);
+        $json = $this->getJsonElementUpdate($htmlFormElementName, $value, $formElement[FE_MODE]);
 
         $element = Support::wrapTag("<textarea $attribute>", htmlentities($value), false);
 
@@ -2458,10 +2458,10 @@ abstract class AbstractBuildForm {
      * Parse $formElement[FE_EDITOR_*] settings and build editor settings.
      *
      * @param array $formElement
-     * @param $htmlFormElementId
+     * @param $htmlFormElementName
      * @return array
      */
-    private function setEditorConfig(array $formElement, $htmlFormElementId) {
+    private function setEditorConfig(array $formElement, $htmlFormElementName) {
         $flagMaxHeight = false;
 
         // plugins
@@ -2483,7 +2483,7 @@ abstract class AbstractBuildForm {
 
         // autofocus
         if (isset($formElement['autofocus']) && $formElement['autofocus'] == 'yes') {
-            $formElement[FE_EDITOR_PREFIX . 'auto_focus'] = $htmlFormElementId;
+            $formElement[FE_EDITOR_PREFIX . 'auto_focus'] = $htmlFormElementName;
         }
 
         // Check for min_height, max_height
@@ -2545,13 +2545,13 @@ abstract class AbstractBuildForm {
      * Build Grid JQW element.
      *
      * @param array $formElement
-     * @param $htmlFormElementId
+     * @param $htmlFormElementName
      * @param $value
      * @param $fake
      * @param string $mode FORM_LOAD | FORM_UPDATE | FORM_SAVE
      * @throws UserFormException
      */
-    public function buildGridJQW(array $formElement, $htmlFormElementId, $value, $fake, $mode = FORM_LOAD) {
+    public function buildGridJQW(array $formElement, $htmlFormElementName, $value, $fake, $mode = FORM_LOAD) {
         // TODO: implement
         throw new UserFormException("Not implemented yet: buildGridJQW()", ERROR_NOT_IMPLEMENTED);
     }
@@ -2560,13 +2560,13 @@ abstract class AbstractBuildForm {
      * Build Note.
      *
      * @param array $formElement
-     * @param $htmlFormElementId
+     * @param $htmlFormElementName
      * @param $value
      * @param string $mode FORM_LOAD | FORM_UPDATE | FORM_SAVE
      * @param array $json
      * @return mixed
      */
-    public function buildNote(array $formElement, $htmlFormElementId, $value, array &$json, $mode = FORM_LOAD) {
+    public function buildNote(array $formElement, $htmlFormElementName, $value, array &$json, $mode = FORM_LOAD) {
         return Support::wrapTag("<div class='qfq-note'>", $value);
     }
 
@@ -2574,12 +2574,12 @@ abstract class AbstractBuildForm {
      * Build Pill:
      *
      * @param array $formElement
-     * @param $htmlFormElementId
+     * @param $htmlFormElementName
      * @param $value
      * @param array $json
      * @return mixed
      */
-    public function buildPill(array $formElement, $htmlFormElementId, $value, array &$json) {
+    public function buildPill(array $formElement, $htmlFormElementName, $value, array &$json) {
         return $value;
     }
 
@@ -2587,7 +2587,7 @@ abstract class AbstractBuildForm {
      * Build a HTML fieldset. Renders all assigned FormElements inside the fieldset.
      *
      * @param array $formElement
-     * @param $htmlFormElementId
+     * @param $htmlFormElementName
      * @param $value
      * @param array $json
      * @param string $mode FORM_LOAD | FORM_UPDATE | FORM_SAVE
@@ -2595,13 +2595,13 @@ abstract class AbstractBuildForm {
      * @throws CodeException
      * @throws DbException
      */
-    public function buildFieldset(array $formElement, $htmlFormElementId, $value, array &$json, $mode = FORM_LOAD) {
+    public function buildFieldset(array $formElement, $htmlFormElementName, $value, array &$json, $mode = FORM_LOAD) {
         $attribute = '';
 
         // save parent processed FE's
         $tmpStore = $this->feSpecNative;
 
-        $attribute .= Support::doAttribute('name', $htmlFormElementId);
+        $attribute .= Support::doAttribute('name', $htmlFormElementName);
         $attribute .= Support::doAttribute('data-load', ($formElement[FE_DYNAMIC_UPDATE] === 'yes') ? 'data-load' : '');
 
         // <fieldset>
@@ -2627,7 +2627,7 @@ abstract class AbstractBuildForm {
         // restore parent processed FE's
         $this->feSpecNative = $tmpStore;
 
-        $json = $this->getJsonElementUpdate($htmlFormElementId, $value, $formElement[FE_MODE]);
+        $json = $this->getJsonElementUpdate($htmlFormElementName, $value, $formElement[FE_MODE]);
 
         return $html;
     }
@@ -2637,7 +2637,7 @@ abstract class AbstractBuildForm {
      * If there are already vlaues for the formElements, fill as much copies as values exist
      *
      * @param array $formElement
-     * @param $htmlFormElementId
+     * @param $htmlFormElementName
      * @param $value
      * @param array $json
      * @param string $mode FORM_LOAD | FORM_UPDATE | FORM_SAVE
@@ -2645,7 +2645,7 @@ abstract class AbstractBuildForm {
      * @throws CodeException
      * @throws DbException
      */
-    public function buildTemplateGroup(array $formElement, $htmlFormElementId, $value, array &$json, $mode = FORM_LOAD) {
+    public function buildTemplateGroup(array $formElement, $htmlFormElementName, $value, array &$json, $mode = FORM_LOAD) {
         $attribute = '';
         $html = '';
 
@@ -2713,7 +2713,7 @@ EOT;
         $tmpFe[FE_LABEL] = '';
         $tmpFe[FE_NOTE] = '';
         $this->fillWrapLabelInputNote($tmpFe[FE_BS_LABEL_COLUMNS], $tmpFe[FE_BS_INPUT_COLUMNS], $tmpFe[FE_BS_NOTE_COLUMNS]);
-        $html .= $this->buildRowNative($tmpFe, $htmlAdd, $htmlFormElementId);
+        $html .= $this->buildRowNative($tmpFe, $htmlAdd, $htmlFormElementName);
 
         $html = $this->wrap[WRAP_SETUP_IN_TEMPLATE_GROUP][WRAP_SETUP_START] . $html . $this->wrap[WRAP_SETUP_IN_TEMPLATE_GROUP][WRAP_SETUP_END];
 
@@ -2734,7 +2734,7 @@ EOT;
         $this->feSpecNative = $feSpecNativeSave;
 
         //TODO: nicht klar ob das hier noetig ist.
-//        $json = $this->getJsonElementUpdate($htmlFormElementId, $value, $formElement[FE_MODE]);
+//        $json = $this->getJsonElementUpdate($htmlFormElementName, $value, $formElement[FE_MODE]);
 
         return $html;
 
@@ -2811,6 +2811,6 @@ EOT;
         return $html;
     }
 
-    abstract public function buildRowNative(array $formElement, $htmlElement, $htmlFormElementId);
+    abstract public function buildRowNative(array $formElement, $htmlElement, $htmlFormElementName);
 
 }
\ No newline at end of file
diff --git a/extension/qfq/qfq/BuildFormBootstrap.php b/extension/qfq/qfq/BuildFormBootstrap.php
index 37158c7ce..b618dc094 100644
--- a/extension/qfq/qfq/BuildFormBootstrap.php
+++ b/extension/qfq/qfq/BuildFormBootstrap.php
@@ -384,11 +384,11 @@ EOF;
 
     /**
      * @param array $formElement
-     * @param $htmlFormElementId
+     * @param $htmlFormElementName
      * @param $value
      * @return mixed
      */
-    public function buildPill(array $formElement, $htmlFormElementId, $value, array &$json) {
+    public function buildPill(array $formElement, $htmlFormElementName, $value, array &$json) {
         $html = '';
         // save parent processed FE's
         $tmpStore = $this->feSpecNative;
@@ -408,16 +408,16 @@ EOF;
     /**
      * @param array $formElement Complete FormElement, especially some FE_WRAP
      * @param string $htmlElement Content to wrap.
-     * @param $htmlFormElementId
+     * @param $htmlFormElementName
      * @return string               Wrapped $htmlElement
      * @throws \qfq\UserFormException
      */
-    public function buildRowNative(array $formElement, $htmlElement, $htmlFormElementId) {
+    public function buildRowNative(array $formElement, $htmlElement, $htmlFormElementName) {
         $html = '';
         $htmlLabel = '';
 
         if ($formElement[FE_BS_LABEL_COLUMNS] > 0) {
-            $htmlLabel = $this->buildLabel($htmlFormElementId, $formElement[FE_LABEL]);
+            $htmlLabel = $this->buildLabel($htmlFormElementName, $formElement[FE_LABEL]);
         }
 
         $html .= $this->customWrap($formElement, $htmlLabel, FE_WRAP_LABEL, $formElement[FE_BS_LABEL_COLUMNS],
diff --git a/extension/qfq/qfq/BuildFormPlain.php b/extension/qfq/qfq/BuildFormPlain.php
index ed7639747..5b21f91cb 100644
--- a/extension/qfq/qfq/BuildFormPlain.php
+++ b/extension/qfq/qfq/BuildFormPlain.php
@@ -65,12 +65,12 @@ class BuildFormPlain extends AbstractBuildForm {
     }
 
     /**
-     * @param $htmlFormElementId
+     * @param $htmlFormElementName
      * @param $formElement
      * @param $value
      * @return string
      */
-    public function buildRowNative(array $formElement, $htmlElement, $htmlFormElementId) {
+    public function buildRowNative(array $formElement, $htmlElement, $htmlFormElementName) {
         $html = '';
 
         // Construct Marshaller Name
diff --git a/extension/qfq/qfq/BuildFormTable.php b/extension/qfq/qfq/BuildFormTable.php
index d3ebc3888..559ab69f5 100644
--- a/extension/qfq/qfq/BuildFormTable.php
+++ b/extension/qfq/qfq/BuildFormTable.php
@@ -90,12 +90,12 @@ class BuildFormTable extends AbstractBuildForm {
     }
 
     /**
-     * @param $htmlFormElementId
+     * @param $htmlFormElementName
      * @param $formElement
      * @param $value
      * @return string
      */
-    public function buildRowNative(array $formElement, $htmlElement, $htmlFormElementId) {
+    public function buildRowNative(array $formElement, $htmlElement, $htmlFormElementName) {
         $html = '';
 
         // Construct Marshaller Name
diff --git a/extension/qfq/qfq/Constants.php b/extension/qfq/qfq/Constants.php
index a37baf1fd..75ca169ac 100644
--- a/extension/qfq/qfq/Constants.php
+++ b/extension/qfq/qfq/Constants.php
@@ -417,6 +417,7 @@ const API_REDIRECT_URL = 'redirect-url';
 const API_FIELD_NAME = 'field-name';
 const API_FIELD_MESSAGE = 'field-message';
 const API_FORM_UPDATE = 'form-update';
+const API_ELEMENT_UPDATE = 'element-update';
 
 const API_JSON_HIDDEN = 'hidden';
 const API_JSON_DISABLED = 'disabled';
@@ -469,6 +470,7 @@ const GLYPH_ICON_CHECK = 'glyphicon-ok';
 const GLYPH_ICON_CLOSE = 'glyphicon-remove';
 
 // FORM
+const F_ID = 'id';
 const F_NAME = 'name';
 const F_TITLE = 'title';
 const F_TABLE_NAME = 'tableName';
@@ -570,6 +572,8 @@ const FE_TEMPLATE_GROUP_NAME_PATTERN = '%d';
 const FE_BUTTON_CLASS = 'buttonClass';
 const RETYPE_FE_NAME_EXTENSION = 'RETYPE';
 
+const FE_HTML_ID = 'htmlId'; // Will be dynamically computed during runtime.
+
 // FormElement Types
 const FE_TYPE_UPLOAD = 'upload';
 const FE_TYPE_EXTRA = 'extra';
diff --git a/extension/qfq/qfq/QuickFormQuery.php b/extension/qfq/qfq/QuickFormQuery.php
index 0d0d27719..d1970ad96 100644
--- a/extension/qfq/qfq/QuickFormQuery.php
+++ b/extension/qfq/qfq/QuickFormQuery.php
@@ -185,8 +185,10 @@ class QuickFormQuery {
     public function process() {
         $html = '';
 
-        if ($this->store->getVar(TYPO3_DEBUG_SHOW_BODY_TEXT, STORE_TYPO3) === '1') {
-            $html .= Support::appendTooltip('', $this->t3data['bodytext']);
+        if ($this->store->getVar(TYPO3_DEBUG_SHOW_BODY_TEXT, STORE_TYPO3) === 'yes') {
+//            TODO: hier den Tootltip mit eienr ID versehen
+//            $htmlId = HelperFormElement::buildFormElementId($this->)
+            $html .= Support::doTooltip('', $this->t3data['bodytext']);
         }
 
         $html .= $this->doForm(FORM_LOAD);
diff --git a/extension/qfq/qfq/helper/HelperFormElement.php b/extension/qfq/qfq/helper/HelperFormElement.php
index 24748830f..9c165b373 100644
--- a/extension/qfq/qfq/helper/HelperFormElement.php
+++ b/extension/qfq/qfq/helper/HelperFormElement.php
@@ -64,7 +64,7 @@ class HelperFormElement
     }
 
     /**
-     * Build the FE name: <field>:<record index)
+     * Build the FE name: <field>-<record index)
      *
      * @param string $field
      * @param string $id
@@ -72,7 +72,20 @@ class HelperFormElement
      */
     public static function buildFormElementName($field, $id)
     {
-        return ($field . ':' . $id);
+        return "$field-$id";
+    }
+
+    /**
+     * Build the FE id: <$formId>-<$formElementId>-<$formElementCopy>
+     *
+     * @param $formId
+     * @param $formElementId
+     * @param $recordId
+     * @param $formElementCopy
+     * @return string
+     */
+    public static function buildFormElementId($formId, $formElementId, $recordId, $formElementCopy) {
+        return "$formId-$formElementId-$recordId-$formElementCopy";
     }
 
     /**
@@ -82,8 +95,8 @@ class HelperFormElement
      * @param string $index
      * @return string
      */
-    public static function prependFormElementIdCheckBoxMulti($field, $index) {
-        return ('_' . $index . '_' . $field);
+    public static function prependFormElementNameCheckBoxMulti($field, $index) {
+        return '_' . $index . '_' . $field;
     }
 
     /**
diff --git a/extension/qfq/qfq/helper/Support.php b/extension/qfq/qfq/helper/Support.php
index d023b8e3c..1b3f38a32 100644
--- a/extension/qfq/qfq/helper/Support.php
+++ b/extension/qfq/qfq/helper/Support.php
@@ -84,6 +84,20 @@ class Support {
         return $tag . $value . $closing;
     }
 
+    /**
+     * Wraps some $inner fragment with a CSS styled $tooltipText . CSS is configured in 'Resources/Public/qfq-jqw.css'.
+     *
+     * Based on: http://www.w3schools.com/howto/howto_css_tooltip.asp
+     *
+     * @param string $before
+     * @param string $tooltipText
+     * @return string
+     */
+    public static function doTooltip($htmlId, $tooltipText) {
+
+        return "<img " . self::doAttribute('id', $htmlId) . " src='" . GFX_INFO . "' title=\"" . htmlentities($tooltipText) . "\">";
+    }
+
     /**
      * Format's an attribute: $type=$value. If $flagOmitEmpty==true && $value=='': return ''.
      *
@@ -161,23 +175,6 @@ class Support {
         return $newStr;
     }
 
-    /**
-     * Wraps some $inner fragment with a CSS styled $tooltipText . CSS is configured in 'Resources/Public/qfq-jqw.css'.
-     *
-     * Based on: http://www.w3schools.com/howto/howto_css_tooltip.asp
-     *
-     * @param string $before
-     * @param string $tooltipText
-     * @return string
-     */
-    public static function appendTooltip($before, $tooltipText) {
-
-        // addslashes, htmlentities & htmlspecialchars
-        // str_replace('"', '&quot;', $tooltipText)
-
-        return $before . "<img src='" . GFX_INFO . "' title=\"" . htmlentities($tooltipText) . "\">";
-    }
-
     /**
      * Search for the parameter $needle in $haystack. The arguments has to be seperated by ','.
      *
diff --git a/extension/qfq/qfq/store/FillStoreForm.php b/extension/qfq/qfq/store/FillStoreForm.php
index 42a0907c2..ad75eda29 100644
--- a/extension/qfq/qfq/store/FillStoreForm.php
+++ b/extension/qfq/qfq/store/FillStoreForm.php
@@ -246,7 +246,7 @@ class FillStoreForm {
      */
     private function collectMultiValues($clientFieldName, array $clientValues) {
 
-        $checkboxKey = HelperFormElement::prependFormElementIdCheckBoxMulti($clientFieldName, 'h');
+        $checkboxKey = HelperFormElement::prependFormElementNameCheckBoxMulti($clientFieldName, 'h');
 
         // For templateGroups: all expanded FormElements will be tried to collect - this fails for not submitted fields.
         // Therefore skip not existing clientvalues.
@@ -258,7 +258,7 @@ class FillStoreForm {
         if (isset($clientValues[$checkboxKey])) {
             $checkboxValue = $clientValues[$checkboxKey];
 
-            $pattern = '/' . HelperFormElement::prependFormElementIdCheckBoxMulti($clientFieldName, '\d+') . '/';
+            $pattern = '/' . HelperFormElement::prependFormElementNameCheckBoxMulti($clientFieldName, '\d+') . '/';
             foreach ($clientValues as $key => $value) {
                 if (1 === preg_match($pattern, $key)) {
                     $checkboxValue .= ',' . $value;
-- 
GitLab