Restricting leading Zero on Thailand Android Client
Closed this issue · 3 comments
samkanga commented
Rkareko commented
@madrinekariuki cc @samkanga we need to test whether use of regex to restrict entry of leading zeros on the android client forms. This question can be used to test this.
How to test
- Using the current forms verify that it's possible to enter
01
as an answer forThe total number of existing LLINs is required
- Download the bednet form and add the regex epression to the
The total number of existing LLINs is required
question. The field should now looak like
{
"key": "existingLLINs",
"openmrs_entity_parent": "",
"openmrs_entity": "",
"openmrs_entity_id": "",
"type": "edit_text",
"hint": "How many existing LLINs?",
"edit_type": "number",
"v_required": {
"value": true,
"err": "The total number of existing LLINs is required"
},
"v_numeric": {
"value": "true",
"err": "Must be a number"
},
"v_min": {
"value": "0",
"err": "Must be greater than or equal to 0"
},
"relevance": {
"step1:eligibleForNet": {
"type": "string",
"ex": "equalTo(., \"1\")"
}
},
"v_regex": {
"value": "^([1-9][0-9]{0,2}|0)$",
"err": "Number must not start with a zero"
}
}
This is the regex used to restrict entry of zero's before integers
"v_regex": {
"value": "^([1-9][0-9]{0,2}|0)$",
"err": "Number must not start with a zero"
}
- Upload the bednet form via form config
- Sync the android app and test whether the restriction takes effect
madrinekariuki commented
@Rkareko
please confirm the expected results after the restriction.
see current findings on the screenshot below:
- The error is not showing when I input a value the starts with zero.
- Also confirm, if the
The total number of existing LLINs
is required is actually zero will inputting0
prompt the error message?
madrinekariuki commented
@Rkareko
I have retested this and It has passed QA.
android apk used. v5.3.29 th-en
user: test77
steps:
Followed these highlighted steps.
Observation:
- After the changes and syncing data, when you open the form you get the message,
form has updates
as expected. - On the Question
The total number of existing LLINs is required
, when you put a digit starting with zero e.g01
one gets an error,Number must not start with a zero
. - when you input the digit 0 or any other number e.g 1,2,3 etc. there is no error message.