Commit 05f4ca25 authored by Elias Villiger's avatar Elias Villiger
Browse files

F3281 - Trim form inputs - refs #3281, closes #3281

parent 8203e8f7
Pipeline #969 passed with stage
in 1 minute and 41 seconds
......@@ -2837,6 +2837,9 @@ See also at specific *FormElement* definitions.
| min | s/d/n | Minimum and/or maximum allowed values for input field. Can be used for numbers, dates, or strings. |
+------------------------+--------+ |
| max | s/d/n | *Always use the international format 'yyyy-mm-dd[ hh:mm[:ss]]* |
+------------------------+--------+----------------------------------------------------------------------------------------------------------+
| trim | string | By default, whitespace is trimmed. To disable, use 'trim=none'. You can also specify custom trim |
| | | characters: 'trim=\\ ' only trims spaces. |
+------------------------+--------+----------------------------------------------------------------------------------------------------------+
* `s/d/n`: string or date or number.
......
......@@ -987,6 +987,8 @@ const FE_FILE_AUTO_ORIENT_CMD_DEFAULT = 'convert -auto-orient {{fileDestination:
const FE_FILE_AUTO_ORIENT_MIME_TYPE = 'autoOrientMimeType';
const FE_FILE_CHMOD_FILE = 'chmodFile';
const FE_FILE_CHMOD_DIR = 'chmodDir';
const FE_TRIM = 'trim'; // 'none' | list of characters
const FE_TRIM_NONE = 'none';
// Excel Import
const FE_IMPORT_TO_TABLE = 'importToTable';
......
......@@ -270,6 +270,13 @@ class FillStoreForm {
if ($formElement[FE_DYNAMIC_UPDATE] === 'yes' || $formElement[FE_MODE] === FE_MODE_REQUIRED || $formElement[FE_MODE] === FE_MODE_SHOW) {
$val = $clientValues[$clientFieldName];
// Trim input
if (empty($formElement[FE_TRIM])) {
$val = trim($val);
} elseif ($formElement[FE_TRIM] !== FE_TRIM_NONE) {
$val = trim($val, $formElement[FE_TRIM]);
}
switch ($formElement[FE_TYPE]) {
case FE_TYPE_DATE:
case FE_TYPE_DATETIME:
......
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