Commit 913b7f3a authored by Carsten  Rose's avatar Carsten Rose
Browse files

Refs #9691: Radio Plain um HTML Attribute 'required' auf input element...

Refs #9691: Radio Plain um HTML Attribute 'required' auf input element erweitert. Element erzeugt aber trotzdem kein 'invalid form' wenn nichts angegeben ist.
parent 252cf594
Pipeline #2862 passed with stages
in 3 minutes and 31 seconds
......@@ -1179,6 +1179,7 @@ abstract class AbstractBuildForm {
if (!empty($formElement[FE_MODE_SQL])) {
$class = is_numeric($formElement[FE_BS_INPUT_COLUMNS]) ? ('col-md-' . $formElement[FE_BS_INPUT_COLUMNS]) : $formElement[FE_BS_INPUT_COLUMNS];
// $class = 'col-md-' . $formElement[FE_BS_INPUT_COLUMNS] . ' ';
$json[API_ELEMENT_UPDATE][$key][API_ELEMENT_ATTRIBUTE]['required'] = ($formElement[FE_MODE] == 'required');
$json[API_ELEMENT_UPDATE][$key][API_ELEMENT_ATTRIBUTE]['hidden'] = $statusHidden;
$json[API_ELEMENT_UPDATE][$key][API_ELEMENT_ATTRIBUTE]['readonly'] = $json['disabled'] ? 'readonly' : 'false';
......@@ -1188,6 +1189,7 @@ abstract class AbstractBuildForm {
$optionsId = $formElement[FE_HTML_ID] . '-' . $optionIdx;
$json[API_ELEMENT_UPDATE][$optionsId][API_ELEMENT_ATTRIBUTE] = $json[API_ELEMENT_UPDATE][$key][API_ELEMENT_ATTRIBUTE];
$json[API_ELEMENT_UPDATE][$optionsId][API_ELEMENT_ATTRIBUTE]['data-disabled'] = $json['disabled'] ? 'yes' : 'no';
$json[API_ELEMENT_UPDATE][$optionsId][API_ELEMENT_ATTRIBUTE]['data-required'] = $json['required'] ? 'yes' : 'no';
// Update label class (i.e.: 'qfq-disabled') of Checkbox/Radio (i.e. readonly on/off).
if (isset($formElement[FE_TMP_CLASS_OPTION])) {
......@@ -2354,6 +2356,7 @@ abstract class AbstractBuildForm {
private function getCheckboxRadioOptionId($base, $index, $type = '') {
return $base . '-' . $index . $type;
}
/**
* Submit extra (hidden) values by SIP.
*
......@@ -2571,7 +2574,8 @@ abstract class AbstractBuildForm {
for ($ii = 0; $ii < count($itemValue); $ii++) {
$jj++;
$attribute .= Support::doAttribute('id', $formElement[FE_HTML_ID] . '-' . $ii);
$optionId = $this->getCheckboxRadioOptionId($formElement[FE_HTML_ID], $ii);
$attribute .= Support::doAttribute('id', $optionId);
$attribute .= Support::doAttribute('value', $itemKey[$ii], false); // Always set value, even to '' - #3832
$attribute .= Support::doAttribute(ATTRIBUTE_DATA_REFERENCE, $formElement[FE_DATA_REFERENCE] . '-' . $ii);
......@@ -2610,8 +2614,10 @@ abstract class AbstractBuildForm {
$attribute = $attributeBase;
// Update label class (i.e.: 'qfq-disabled') of Checkbox/Radio (i.e. readonly on/off).
$optionsLabelId = $this->getCheckboxRadioOptionId($formElement[FE_HTML_ID], $ii, HTML_ID_EXTENSION_LABEL);
$jsonTmp[API_ELEMENT_UPDATE][$optionsLabelId][API_ELEMENT_ATTRIBUTE]['class'] = $formElement[FE_TMP_CLASS_OPTION];
$optionLabelId = $this->getCheckboxRadioOptionId($formElement[FE_HTML_ID], $ii, HTML_ID_EXTENSION_LABEL);
$jsonTmp[API_ELEMENT_UPDATE][$optionLabelId][API_ELEMENT_ATTRIBUTE]['class'] = $formElement[FE_TMP_CLASS_OPTION];
$jsonTmp[API_ELEMENT_UPDATE][$optionId][API_ELEMENT_ATTRIBUTE]['required'] = ($formElement[FE_MODE] == FE_MODE_REQUIRED) ? 'required' : 'false';
}
$json = array_merge($this->getFormElementForJson($htmlFormElementName, $value, $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