Overview
Version
Report Server Version | App Version/HTML5 Mobile Display Plugin Version | Functional Change |
11.0.2 | / | Optimized the logic of the Allow Custom Data validation item, so that validation can also be triggered in scenarios such as Excel import and values calculated through formulas. |
V11.0.84 | Optimized the widget validation prompt on mobile terminals, helping users quickly locate widgets with errors. For details, see section "Mobile Terminals". |
Application Scenarios
Data entry widgets can be set with validation rules. If the content entered by the user in the widget does not meet the rules, an error message pops up for validation failure.
The text widget in the following figure has been set to validate phone numbers. If the entered content does not meet the format of phone numbers, the validation fails.
The content that meets the format of phone numbers will pass the validation after you confirm it.
Where to Set
Not all widgets can be set with validation. Only some widgets have validation settings in the attribute panel, as shown in the following figure.
Validation Rule
Validation Rule | Rule Description | Figure | Supported Widget |
Allow Null | · Whether allow the widget content to be empty · Custom error message is supported. | | Text Widget Text Area Widget Number Widget Password Widget Radio Button Group Widget Checkbox Group Drop-down Box Widget Drop-down Checkbox Widget Date Widget File Widget List Widget Drop-Down Tree View Tree |
Length | · You can limit the number of characters in the text. · You can set the minimum and maximum number of characters. · Custom error message is supported. | | Text Widget Text Area Widget Password Widget |
Email | · The entered content must be in email format. · Custom error message is supported. | | Text Widget |
ID Card | · The entered content must be in ID card format. · Custom error message is supported. | | Text Widget |
Post Code | · The entered content must be in post code format. · Custom error message is supported. | | Text Widget |
Phone | · The entered content must be in phone number format. · You can choose the data type of the phone number. · Custom error message is supported. | | Text Widget |
Mobile Phone | · The entered content must be in mobile phone number format. · Custom error message is supported. | | Text Widget |
Custom | · Regular expression is used. · For details, see Regular Expression. · Custom error message is supported. | | Text Widget Text Area Widget Password Widget |
Allow Decimals | · Whether allow decimals · The maximum decimal digits can be set. | | Number Widget |
Allow Negative | · Whether allow numbers to be negative | | Number Widget |
Need Maximum Value Need Minimum Value | · You can limit the number within a certain range. · The maximum and minimum value can be set. · Custom error message is supported. | | Number Widget |
Allow Edit | · Whether allow a dropdown box to be entered content directly | | Drop-down Box Widget Drop-down Checkbox Widget Date Widget Drop-Down Tree |
Allow Custom Data | Whether values that are not in the drop-down list can be entered in the cell where the widget is located When the function is not enabled, if you directly enter a value (not in the drop-down list) in the cell where the widget is located, the entered value in the drop-down box is automatically cleared and the message Value is not in the drop-down list is displayed in a pop-up prompt box. Content directly entered does not pass the validation in FineReport of V11.0.2 and later versions. For example, Excel import, values calculated through formulas, values copied and pasted from Excel, and values assigned to a cell by JS will trigger validation. If values do not meet the rules and you click Submit or Data Validation, an error message is displayed in a pop-up window, indicating that custom data is not allowed. | | Drop-down Box Widget Drop-down Checkbox Widget Drop-Down Tree |
Mobile Terminal
Single Widget Validation
A fill rule is set for a widget, as shown in the following figure.
After you enter a value, the widget performs a blur validation. If the entered value does not meet the rules, the widget is highlighted in red, and an error message pops up.
Overall Validation
Widgets on mobile terminals are set to not allow null, as shown in the following figure.
The error message Verification Fails is displayed and the corresponding widgets are highlighted in red. The default error prompt is Illegal Insert.
An error prompt is set, as shown in the following figure.
The effect is shown as follows.
Notes
1. After you enter data that does not meet the validation rules, the widget will automatically return to the last entered content.
2. When you submit the form, the submitted data will also be checked based on the validation rules of the widgets.
3. The validation individually set for a widget is not triggered if you import Excel, while the Allow Custom Data validation is triggered in FineReport of V11.0.2 and later versions.