Page 1 of 1
stop numeric in alpha field
Posted: January 30th, 2013, 10:28 am
by rameshpal99
Dear Sir,
I have request to you for stop numeric in alpha field.
Thanks
Ramesh
Re: stop numeric in alpha field
Posted: February 4th, 2013, 12:30 am
by khurshid.arshad
Dear;
Please see this code:
PROC GLOBAL
Function OnKey(x);
if getsymbol()="RESPONDENT" or getsymbol()="INTERVIEWER" or getsymbol()="UC_NAME" or
getsymbol()="CONTACT_PERSON" then
if x in 65:90,13, 8, 32, 46, 37:40, 219,221 then { Alpha "65:90, 13=Enter, 8=Bksp, 32=Space, 46=Delete}
OnKey = x;
else
OnKey = 0;
endif;
elseif getsymbol()="LATITUDE" or getsymbol()="LONGITUDE" then \\If you want enter only Numeric in Text Field
if x in 48:57,96:105,110, 46, 8, 13 then { Numeric "48:57, keypad=96:105, decimal = 110,8=Bksp, 46=Delete, 13=Enter}
OnKey = x;
else
OnKey = 0;
endif;
else
Onkey = x;
endif;
end;
Regards.
Arshad
Re: stop numeric in alpha field
Posted: February 4th, 2013, 2:14 pm
by Gregory Martin
There is no way to do this for every alpha field. You will have to do something similar to what Arshad mentioned, where you override the OnKey function and specify the fields where you don't want numeric values entered. Something like this:
function OnKey(keystroke)
OnKey = keystroke;
if getsymbol() in "ALPHAFIELD1","ALPHAFIELD2","ALPHAFIELD3" then
if keystroke in 48:57 then
OnKey = 0; // disable the keystroke
endif;
endif;
end;
Re: stop numeric in alpha field
Posted: February 9th, 2013, 2:06 pm
by Bharadwaj
Dear Ramesh
If you are unable to understand above two functions you can use following syntax in Alpha field postproc to avoid other characters
i = 0;
do while i < 30
if not $[i:1] in "A":"Z" then
errmsg("Check entered Name");
reenter;
endif;
i = i +1;
enddo;
Regards
Bharadwaj