Page 1 of 1
How do I test DATA ENTRY FIELD for just numbers - Solved
Posted: Tue Jul 21, 2015 10:29 am
by DR White
How do I test a Data entry field for just numbers and decimal point?
Thanks,
David
Re: How do I test DATA ENTRY FIELD for just numbers and deci
Posted: Tue Jul 21, 2015 10:58 am
by jmburnod
Hi David,
You can use this in your field script :
Code: Select all
on keyDown pkey
if pkey is in "1234567890." then
put pkey after me
end if
end keyDown
Best regards
Jean-Marc
Re: How do I test DATA ENTRY FIELD for just numbers and deci
Posted: Tue Jul 21, 2015 12:15 pm
by DR White
Jean-Marc,
That works Great!!
Thanks,
David
Re: How do I test DATA ENTRY FIELD for just numbers and deci
Posted: Tue Jul 21, 2015 3:44 pm
by MaxV
I prefer this:
Code: Select all
on closeField
if the text of me is not a number then
beep
answer "Please enter a valid number."
select text of me
end if
end closeField
Re: How do I test DATA ENTRY FIELD for just numbers and deci
Posted: Wed Jul 22, 2015 5:37 pm
by atout66
You can also use:
Code: Select all
on keyDown k
if k is a number then pass keyDown
end keyDown
which is closed to Jean-Marc...
Regards, Jean-Paul.
Re: How do I test DATA ENTRY FIELD for just numbers and deci
Posted: Wed Jul 22, 2015 7:07 pm
by dunbarx
Jean-Paul.
The "pass" method has its own charm. But you always need to include the decimal point.
Craig