numeri or alpha fix

Discussions about CSEntry
Post Reply
ahmad
Posts: 2
Joined: July 11th, 2021, 12:46 am

numeri or alpha fix

Post by ahmad » July 11th, 2021, 12:49 am

how can we fix numeric or alpha ?when we enter data then box take only numeric or alpha. Kindly share the command or logic.

aaronw
Posts: 458
Joined: June 9th, 2016, 9:38 am
Location: Washington, DC

Re: numeri or alpha fix

Post by aaronw » July 12th, 2021, 10:54 am

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;

Post Reply