From b2192397224ff54ae78c740b6fb3e2aef7fe3963 Mon Sep 17 00:00:00 2001
From: Carsten  Rose <carsten.rose@math.uzh.ch>
Date: Sat, 25 Mar 2017 12:30:49 +0100
Subject: [PATCH] HelpFormElement.php: Introduced new constants
 HTML_DELIMITER_NAME, HTML_DELIMITER_ID AbstractBuildForm.php: Saving 'extra'
 FE in STORE_SIP has been done with inappropiate FE_NAME. Correct is the pure
 FE_NAME, without any extension like recordId. Unessary and broken decoding
 removed.

---
 extension/qfq/qfq/AbstractBuildForm.php        | 6 +++---
 extension/qfq/qfq/Constants.php                | 3 +++
 extension/qfq/qfq/helper/HelperFormElement.php | 4 ++--
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/extension/qfq/qfq/AbstractBuildForm.php b/extension/qfq/qfq/AbstractBuildForm.php
index ae437fc72..75bb0dd15 100644
--- a/extension/qfq/qfq/AbstractBuildForm.php
+++ b/extension/qfq/qfq/AbstractBuildForm.php
@@ -1694,9 +1694,9 @@ abstract class AbstractBuildForm {
 
         if ($mode === FORM_LOAD) {
             // Split 'grId:0' in 'grId' and '0'
-            $name = explode(':', $htmlFormElementName, 2);
-
-            $this->store->setVar($name[0], $value, STORE_SIP, false);
+//            $name = explode(':', $htmlFormElementName, 2);
+//            $this->store->setVar($name[0], $value, STORE_SIP, false);
+            $this->store->setVar($formElement[FE_NAME], $value, STORE_SIP, false);
         }
     }
 
diff --git a/extension/qfq/qfq/Constants.php b/extension/qfq/qfq/Constants.php
index c3f67c606..045e15f10 100644
--- a/extension/qfq/qfq/Constants.php
+++ b/extension/qfq/qfq/Constants.php
@@ -688,6 +688,9 @@ const ESCAPE_WITH_HTML_QUOTE = 'htmlquote';
 const FLAG_ALL = 'flagAll';
 const FLAG_DYNAMIC_UPDATE = 'flagDynamicUpdate';
 
+const HTML_DELIMITER_NAME = '-';
+const HTML_DELIMITER_ID = HTML_DELIMITER_NAME;
+
 const HTML_ID_EXTENSION_LABEL = '-l';
 const HTML_ID_EXTENSION_INPUT = '-i';
 const HTML_ID_EXTENSION_NOTE = '-n';
diff --git a/extension/qfq/qfq/helper/HelperFormElement.php b/extension/qfq/qfq/helper/HelperFormElement.php
index 89417e917..9fce47ac0 100644
--- a/extension/qfq/qfq/helper/HelperFormElement.php
+++ b/extension/qfq/qfq/helper/HelperFormElement.php
@@ -72,7 +72,7 @@ class HelperFormElement
      */
     public static function buildFormElementName($field, $id)
     {
-        return "$field-$id";
+        return "$field" . HTML_DELIMITER_NAME . "$id";
     }
 
     /**
@@ -85,7 +85,7 @@ class HelperFormElement
      * @return string
      */
     public static function buildFormElementId($formId, $formElementId, $recordId, $formElementCopy) {
-        return "$formId-$formElementId-$recordId-$formElementCopy";
+        return "$formId" . HTML_DELIMITER_ID . "$formElementId" . HTML_DELIMITER_ID . "$recordId" . HTML_DELIMITER_ID . "$formElementCopy";
     }
 
     /**
-- 
GitLab