Closed chrisly-bear closed 5 years ago
For input validation we can use the TextFormField
's inputFormatters
, e.g.:
inputFormatters: [
WhitelistingTextInputFormatter(RegExp('[a-z0-9]')), // change the regex to something sensible
LengthLimitingTextInputFormatter(12),
]
Closed with #50.
Input Field Types
Make sure all input fields have the right type.
E.g.
Input Field Validation
Make sure all fields are validated for correctness before being stored in the database.
E.g.
Update 14.06.2019:
The following inputs should be checked for correctness:
ART Number: This is the most important one because it needs to be correct for proper communication with the viral load database (#6, #7, #17). The format should be
A/01/01234
, i.e., one letter (A-Za-z), followed by two characters which can be any letter or digit (A-Za-z0-9), followed by five digits (0-9). The slashes (/
) are just for visual separation and do not have to be provided → We could provide three independent fields for each part of the ART Number or do it all in one field.Phone Numbers: The format should be
+266-12-345-678
, i.e., the Lesotho country code followed by 8 digits (0-9). The dashes (-
) are just for visual separation and do not have to be provided. We only allow Lesotho numbers starting with +266, thus the user should not have to write +266 manually, instead he/she should only have to provide the 8 digits after.Sticker Number: The format should be
P123
, i.e., the letter P followed by three digits (0-9). Since the letter P always comes first, the user should only have to provide the three digits and the P should be prefixed automatically (like with phone numbers).(The viral load lab number does not have to be validated.)