Commit a0243d9f authored by Carsten  Rose's avatar Carsten Rose
Browse files

Bug #3647 / Dynamic Update: Multiple Elements in a row not updated properly.

Current fix is just a workaround. Further implications might exist. E.g. 'text' and 'date' should be fine, but 'select' / 'checkbox' / 'radios' / ... are not tested and probably won't work.
Support.php: set flags for 'row' / '/row'.
AbstractBuildForm.php, BuildFormBootstrap.php: $flagRowUpdate switches logic between full 'row update' (only one FE in the row) and 'per element'. In 'per element'-Mode, not all input types are updated properly.
parent c950445a
......@@ -712,7 +712,17 @@ abstract class AbstractBuildForm {
$json = $this->getJsonFeMode($formElement[FE_MODE]); // disabled, required
$json['form-element'] = $htmlFormElementName;
$json['value'] = $value;
if (isset($formElement[FE_FLAG_ROW_OPEN_TAG]) && isset($formElement[FE_FLAG_ROW_CLOSE_TAG])) {
$flagRowUpdate = ($formElement[FE_FLAG_ROW_OPEN_TAG] && $formElement[FE_FLAG_ROW_CLOSE_TAG]);
} else {
$flagRowUpdate = true;
}
// 'value' update via 'form-update' on the full row: only if there is no other FE that row
if ($flagRowUpdate) {
$json['value'] = $value;
}
if (isset($formElement[FE_LABEL])) {
$key = $formElement[FE_HTML_ID] . HTML_ID_EXTENSION_LABEL;
......@@ -738,6 +748,11 @@ abstract class AbstractBuildForm {
$class .= ($formElement[FE_MODE] == FE_MODE_HIDDEN) ? 'hidden' : '';
$json[API_ELEMENT_UPDATE][$key][API_ELEMENT_ATTRIBUTE]['class'] = $class;
}
// #3647
if (!$flagRowUpdate) {
$json[API_ELEMENT_UPDATE][$formElement[FE_HTML_ID]][API_ELEMENT_ATTRIBUTE]['value'] = $value;
}
}
// Show / Hide the complete FormElement Row.
......
......@@ -524,11 +524,8 @@ EOF;
$classHideRow = '';
$classHideElement = '';
$flagRowOpenTag = Support::findInSet('row', $formElement[FE_WRAP_ROW_LABEL_INPUT_NOTE]);
$flagRowCloseTag = Support::findInSet('/row', $formElement[FE_WRAP_ROW_LABEL_INPUT_NOTE]);
if ($formElement[FE_MODE] == FE_MODE_HIDDEN) {
if ($flagRowOpenTag && $flagRowCloseTag) {
if ($formElement[FE_FLAG_ROW_OPEN_TAG] && $formElement[FE_FLAG_ROW_CLOSE_TAG]) {
$classHideRow = 'hidden';
} else {
$classHideElement = 'hidden';
......@@ -554,8 +551,8 @@ EOF;
[$this->wrap[WRAP_SETUP_NOTE][WRAP_SETUP_START], $this->wrap[WRAP_SETUP_NOTE][WRAP_SETUP_END]], $formElement[FE_HTML_ID] . HTML_ID_EXTENSION_NOTE);
// Row
$openTag = $flagRowOpenTag ? $this->getRowOpenTag($classHideRow) : '';
$closeTag = $flagRowCloseTag ? $this->wrap[WRAP_SETUP_ELEMENT][WRAP_SETUP_END] : '';
$openTag = $formElement[FE_FLAG_ROW_OPEN_TAG] ? $this->getRowOpenTag($classHideRow) : '';
$closeTag = $formElement[FE_FLAG_ROW_CLOSE_TAG] ? $this->wrap[WRAP_SETUP_ELEMENT][WRAP_SETUP_END] : '';
$html = $this->customWrap($formElement, $html, FE_WRAP_ROW, -1, [$openTag, $closeTag], $formElement[FE_HTML_ID] . HTML_ID_EXTENSION_ROW);
......
......@@ -822,6 +822,8 @@ const FE_TMP_EXTRA_BUTTON_HTML = '_extraButtonHtml'; // will be filled on the fl
const FE_CHECKBOX_CHECKED = 'checked';
const FE_CHECKBOX_UNCHECKED = 'unchecked';
const FE_FLAG_ROW_OPEN_TAG = '_flagRowOpenTag'; // will be automatically computed during Formload: true | false
const FE_FLAG_ROW_CLOSE_TAG = '_flagRowCloseTag'; // will be automatically computed during Formload: true | false
const RETYPE_FE_NAME_EXTENSION = 'RETYPE';
......
......@@ -670,6 +670,15 @@ class Support {
$formElement[FE_MODE] = $formElement[FE_MODE_SQL];
}
// Will be used to change dynamicUpdate behaviour
if (isset($formElement[FE_WRAP_ROW_LABEL_INPUT_NOTE])) {
$formElement[FE_FLAG_ROW_OPEN_TAG] = Support::findInSet('row', $formElement[FE_WRAP_ROW_LABEL_INPUT_NOTE]);
$formElement[FE_FLAG_ROW_CLOSE_TAG] = Support::findInSet('/row', $formElement[FE_WRAP_ROW_LABEL_INPUT_NOTE]);
} else {
$formElement[FE_FLAG_ROW_OPEN_TAG] = true;
$formElement[FE_FLAG_ROW_CLOSE_TAG] = false;
}
return $formElement;
}
......
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