Commit 1ccc6b9c authored by Carsten  Rose's avatar Carsten Rose
Browse files

Feature #3906 / Mark required inputs with an asterik

Implemented by using a new class ''.required-field'. The class has to be applied to the label. Not implemented is the option, to render the asterix directly on/beside the input (not the label) - probably solved later.
qfq-bs.css.les: New CSS class required-field
AbstractBuildForm.php: extended buildLable() with new parameter $addClass.
BuildFormBootstrap.php: Assign class 'required-field' to label for required fields.
parent 18b88403
......@@ -821,11 +821,12 @@ abstract class AbstractBuildForm {
*
* @param string $htmlFormElementName
* @param string $label
* @param string $addClass
* @return string
*/
public function buildLabel($htmlFormElementName, $label) {
public function buildLabel($htmlFormElementName, $label, $addClass = '') {
$attributes = Support::doAttribute('for', $htmlFormElementName);
$attributes .= Support::doAttribute('class', 'control-label');
$attributes .= Support::doAttribute('class', ['control-label', $addClass]);
$html = Support::wrapTag("<label $attributes>", $label);
......
......@@ -565,7 +565,8 @@ EOF;
// Label
if ($formElement[FE_BS_LABEL_COLUMNS] > 0) {
$htmlLabel = $this->buildLabel($htmlFormElementName, $formElement[FE_LABEL]);
$addClass = ($formElement[FE_MODE] == FE_MODE_REQUIRED) ? CSS_REQUIRED : '';
$htmlLabel = $this->buildLabel($htmlFormElementName, $formElement[FE_LABEL], $addClass);
}
$html .= $this->customWrap($formElement, $htmlLabel, FE_WRAP_LABEL, $formElement[FE_BS_LABEL_COLUMNS],
......
......@@ -432,6 +432,8 @@ const DOWNLOAD_POPUP_REQUEST = 'true';
const DOWNLOAD_POPUP_REPLACE_TEXT = '#downloadPopupReplaceText#';
const DOWNLOAD_POPUP_REPLACE_TITLE = '#downloadPopupReplaceTitle#';
const CSS_REQUIRED = 'required-field';
// die folgenden Elemente sind vermutlich nicht noetig, wenn Store Klassen gloable Vars benutzt.
//const SYSTEM_FORM_DEF = 'formDefinition'; // Type: SANITIZE_ALNUMX / AssocArray. Final form to process. Useful for error reporting.
//const SYSTEM_FORM_ELEMENT_DEF = 'formElementDefinition'; // Type: SANITIZE_ALL / AssocArray. Formelement which are processed at the moment. Useful for error reporting.
......
......@@ -63,6 +63,21 @@ i.@{spinner_class} {
}
}
//.form-group.required.control-label:before{
// color: red;
// content: "*";
// position: absolute;
// margin-left: -10px;
//}
.required-field:after {
color: #d00;
content: "*";
position: absolute;
margin-left: 3px;
top: 10px;
}
.qfq-table-50 {
min-width: 50%;
width: auto;
......
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