How do I test DATA ENTRY FIELD for just numbers - Solved
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
How do I test DATA ENTRY FIELD for just numbers - Solved
How do I test a Data entry field for just numbers and decimal point?
Thanks,
David
Thanks,
David
Last edited by DR White on Mon Jul 27, 2015 2:43 pm, edited 2 times in total.
Re: How do I test DATA ENTRY FIELD for just numbers and deci
Hi David,
You can use this in your field script :
Best regards
Jean-Marc
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
Jean-Marc
https://alternatic.ch
Re: How do I test DATA ENTRY FIELD for just numbers and deci
Jean-Marc,
That works Great!!
Thanks,
David
That works Great!!

Thanks,
David
Re: How do I test DATA ENTRY FIELD for just numbers and deci
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
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
Re: How do I test DATA ENTRY FIELD for just numbers and deci
You can also use:
which is closed to Jean-Marc...
Regards, Jean-Paul.
Code: Select all
on keyDown k
if k is a number then pass keyDown
end keyDown
Regards, Jean-Paul.
Discovering LiveCode Community 6.5.2.
Re: How do I test DATA ENTRY FIELD for just numbers and deci
Jean-Paul.
The "pass" method has its own charm. But you always need to include the decimal point.
Craig
The "pass" method has its own charm. But you always need to include the decimal point.
Craig