Skip to content
Snippets Groups Projects
Commit c8fed1ac authored by Carsten  Rose's avatar Carsten Rose
Browse files

F6563 Accept 0 as required. implemented

parent 1977a980
No related branches found
No related tags found
No related merge requests found
Pipeline #791 passed
......@@ -2737,11 +2737,13 @@ See also at specific *FormElement* definitions.
| unchecked | string | |
| label2 | string | |
| itemList | string | |
| emptyHide | string | |
| emptyItemAtStart | string | |
| emptyItemAtEnd | string | |
| emptyHide | - | |
| emptyItemAtStart | - | |
| emptyItemAtEnd | - | |
| buttonClass | string | |
+------------------------+--------+----------------------------------------------------------------------------------------------------------+
| acceptZeroAsRequired | string | 0|1 - Accept a '0' as a valid input. Default '0' (=0 is not a valid input) |
+------------------------+--------+----------------------------------------------------------------------------------------------------------+
| dateFormat | string | yyyy-mm-dd | dd.mm.yyyy |
+------------------------+--------+----------------------------------------------------------------------------------------------------------+
| decimalFormat | string | [precision,scale] Limits and formats input to a decimal number with the specified precision and scale. |
......
......@@ -1049,6 +1049,7 @@ const FE_FILE_BUTTON_TEXT = 'fileButtonText';
const FE_FILE_BUTTON_TEXT_DEFAULT = 'Choose File';
const FE_INPUT_TYPE = 'inputType';
const FE_STEP = 'step';
const FE_ACCEPT_ZERO_AS_REQUIRED = 'acceptZeroAsRequired';
const FE_IMAGE_CUT_RESIZE_WIDTH = 'resizeWidth';
const FE_IMAGE_CUT_KEEP_ORIGINAL = 'keepOriginal';
......
......@@ -439,6 +439,11 @@ class Save {
$this->feSpecNative[$key][FE_MODE_SQL] = $mode;
}
if(isset($formElement[FE_ACCEPT_ZERO_AS_REQUIRED]) && $formElement[FE_ACCEPT_ZERO_AS_REQUIRED] != '0' &&
isset($clientValues[$formElement[FE_NAME]]) && $clientValues[$formElement[FE_NAME]]=='0'){
$mode='fake'; // The next if() should never be true.
}
if (!$requiredOff && $mode == FE_MODE_REQUIRED && empty($clientValues[$formElement[FE_NAME]])) {
throw new UserFormException("Missing required value: " . $formElement[FE_LABEL], ERROR_REQUIRED_VALUE_EMPTY);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment