Commit 14365a7f authored by Carsten  Rose's avatar Carsten Rose
Browse files

AbstractBuildForm.php: getting the maxlength of input fields failed for...

AbstractBuildForm.php: getting the maxlength of input fields failed for FormElements which are not a column of the primary table. New: in such situtations no size / maxlength are rendered.
parent 65b7f84a
......@@ -616,16 +616,14 @@ abstract class AbstractBuildForm {
$this->adjustMaxLength($formElement);
// <input>
if ($formElement['maxLength'] > 0) {
if ($formElement['maxLength'] > 0 && $value !== '') {
// crop string only if it's not empty (substr returns false on empty strings)
if ($value !== '')
$value = substr($value, 0, $formElement['maxLength']);
// 'maxLength' needs an upper 'L': naming convention for DB tables!
$attribute .= $this->getAttributeList($formElement, ['type', 'size', 'maxLength']);
$attribute .= Support::doAttribute('value', htmlentities($value), false);
$value = substr($value, 0, $formElement['maxLength']);
}
// 'maxLength' needs an upper 'L': naming convention for DB tables!
$attribute .= $this->getAttributeList($formElement, ['type', 'size', 'maxLength']);
$attribute .= Support::doAttribute('value', htmlentities($value), false);
}
$attribute .= $this->getAttributeList($formElement, ['autocomplete', 'autofocus', 'placeholder']);
......
Supports Markdown
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