peej
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2010
05:20 PM
roKeyboard input validation
Is there a way to check if the text entered in the box is numeric?
type(screen.GetText()) returns String
val(type(screen.GetText())) returns Float (even if the text is not numeric)
Thanks!
type(screen.GetText()) returns String
val(type(screen.GetText())) returns Float (even if the text is not numeric)
Thanks!
4 REPLIES 4

RokuKevin
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2010
05:36 PM
Re: roKeyboard input validation
If you just want them to enter a number, you may want to try roPinEntryDialog.
peej
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2010
06:34 AM
Re: roKeyboard input validation
You can't see what you're typing that way, but otherwise it works. In my case the number is a zip code, so having an incorrect zip code (can't see what you're typing) is probably still better than having an invalid zip code (code with letters in it). But if there is a way to make the PinEntryDialog show numbers as you type, that'd be helpful.
WilDD
Roku Guru
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2010
05:39 PM
Re: roKeyboard input validation
"peej" wrote:
Is there a way to check if the text entered in the box is numeric?
type(screen.GetText()) returns String
val(type(screen.GetText())) returns Float (even if the text is not numeric)
Thanks!
Here's a somewhat clunky way to do it, but it works.
Function isInteger(MyText as String) as Boolean
if Len(MyText) = 0 return false
for i = 1 to Len(MyText)
digit = Mid(MyText, i, 1)
if Instr(1, "0123456789", digit) = 0 return false
next
return true
End Function
if isInteger(ZipCode)
' Do normal routine
else
' Do error routine
endif
peej
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2010
08:51 PM
Re: roKeyboard input validation
I like it.
Thanks.

Thanks.