numeri or alpha fix

Discussions about CSEntry
Forum rules
New release: CSPro 8.0
Post Reply
ahmad
Posts: 2
Joined: July 11th, 2021, 12:46 am

numeri or alpha fix

Post 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.
aaronw
Posts: 561
Joined: June 9th, 2016, 9:38 am
Location: Washington, DC

Re: numeri or alpha fix

Post 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;
Post Reply