Commit 09235ef9 authored by Carsten  Rose's avatar Carsten Rose

Temporary workaround to fix 'checkbox save'. Problem: no 'unchecked' values!!! TG not tested.

parent 25447b34
......@@ -213,11 +213,10 @@ class HelperFormElement {
public static function prependFormElementNameCheckBoxMulti($field, $index, $appendArray = false) {
// return '_' . $index . '_' . $field;
$key = '_' . $field;
if ($appendArray) {
$key .= '[]';
return $field . '[]';
}
return $key;
return $field;
}
/**
......
......@@ -257,7 +257,7 @@ class FillStoreForm {
switch ($formElement[FE_TYPE]) {
case FE_TYPE_CHECKBOX:
// Checkbox Multi: collect values
$val = $this->collectMultiValues($clientFieldName, $clientValues);
$val = $this->collectCheckBoxValues($clientFieldName, $clientValues);
if ($val !== false) {
$clientValues[$clientFieldName] = $val;
}
......@@ -352,21 +352,23 @@ class FillStoreForm {
*
* @return string
*/
private function collectMultiValues($clientFieldName, array $clientValues) {
private function collectCheckBoxValues($clientFieldName, array $clientValues) {
$checkboxKey = HelperFormElement::prependFormElementNameCheckBoxMulti($clientFieldName, '', false);
// Check for Single
// $checkboxKey = HelperFormElement::prependFormElementNameCheckBoxMulti($clientFieldName, '', false);
if (!isset($clientValues[$checkboxKey])) {
return '';
}
if (isset($clientValues[$clientFieldName])) {
// single: no array, multi: array
if (!is_array($clientValues[$checkboxKey])) {
return false;
if (is_array($clientValues[$clientFieldName])) {
return implode(',', $clientValues[$clientFieldName]);
}
return $clientValues[$clientFieldName];
}
return false;
return implode(',', $clientValues[$checkboxKey]);
// For templateGroups: all expanded FormElements will be tried to collect - this fails for not submitted fields.
// Therefore skip not existing clientvalues.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment