Page 1 of 1

numeri or alpha fix

Posted: July 11th, 2021, 12:49 am
by ahmad
how can we fix numeric or alpha ?when we enter data then box take only numeric or alpha. Kindly share the command or logic.

Re: numeri or alpha fix

Posted: July 12th, 2021, 10:54 am
by aaronw
You can use a regular expression to prompt the user that the alphanumeric text field only accepts alpha or numeric chars.

helps: https://www.csprousers.org/help/CSPro/r ... ction.html
blog post: https://www.csprousers.org/posts/2019-0 ... sions.html

Example:
if not regexmatch(ALPHA_ONLY_FIELD, "^[a-zA-Z]+$") then
    errmsg
("Field only accepts alpha characters");
   
reenter;
endif;

if not regexmatch(NUMERIC_ONLY_FIELD, "^[0-9]+$") then
    errmsg
("Field only accepts numeric characters");
   
reenter;
endif;