Commit 4fee1995 authored by Carsten  Rose's avatar Carsten Rose
Browse files

#4396 / FE: Justify DATE and TIME in case it's DATETIME on a non primary table.

parent 29a1747d
......@@ -1178,6 +1178,7 @@ abstract class AbstractBuildForm {
// MIN( $formElement['maxLength'], tabledefinition)
$maxLength = $this->getColumnSize($formElement[FE_NAME]);
$feMaxLength = false;
switch ($formElement[FE_TYPE]) {
case 'date':
$feMaxLength = 10;
......@@ -1188,12 +1189,14 @@ abstract class AbstractBuildForm {
case 'time':
$feMaxLength = 8;
break;
default:
$feMaxLength = false;
break;
}
// In case the underlying tablecolumn is not of type date/time, the $maxLength might be to high: correct
// In case there is no limit of the underlying table column, or a non primary table column, and the FE_TYPE is date/time.
if ($maxLength === false && $feMaxLength !== false) {
$maxLength = $feMaxLength;
}
// In case the underlying table column is not of type date/time, the $maxLength might be to high: correct
if ($feMaxLength !== false && $maxLength !== false && $feMaxLength < $maxLength) {
$maxLength = $feMaxLength;
}
......@@ -2795,7 +2798,6 @@ abstract class AbstractBuildForm {
* [maxlength="$maxLength"] [placeholder="$placeholder"] [size="$size"] [min="$min"] [max="$max"]
* [pattern="$pattern"] [required="required"] [disabled="disabled"] value="$value">
*
*
* @param array $formElement
* @param string $htmlFormElementName
* @param string $value
......
......@@ -150,7 +150,6 @@ class BuildFormPlainTest extends AbstractDatabaseTest {
$result = $build->buildInput($formElement2, 'specialname:1', '', $json);
$this->assertEquals('<input id="123" name="specialname:1" class="form-control" maxlength="20" type="input" size="10" value="" data-hidden="no" data-required="no" ><div class="help-block with-errors hidden"></div>', $result);
// Explicit: further
$formElement['tooltip'] = 'Nice Tooltip';
$formElement['placeholder'] = 'Please type a name';
......
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