Planet PDF Forum Planet PDF Forum
  New Posts New Posts RSS Feed - Allow numbers only in textbox?
  FAQ FAQ  Forum Search   Register Register  Login Login

Hi, welcome to the Foxit Planet PDF Forum. If you have PDF or Adobe Acrobat questions then the right place to ask them is here, in this forum.

Allow numbers only in textbox?

 Post Reply Post Reply
Author
mobius55 View Drop Down
New Member
New Member


Joined: 17 Oct 2011
Location: PA
Points: 6
Post Options Post Options   Quote mobius55 Quote  Post ReplyReply Direct Link To This Post Topic: Allow numbers only in textbox?
    Posted: 17 Oct 2011 at 2:52am
I'm trying to format a textbox to accept only numeric data - a 5-digit zipcode. I tried setting the data type to numeric, but I find that leading zeros (i.e. zipcode 07766) are being truncated (to 7766 in this case).

Can anyone suggest a javascript that could accomplish this validation? Tried doing something with (NAN) but my javascripting is, alas, pretty shaky :-o

Thanx!
Back to Top
BAlheit View Drop Down
Senior Member
Senior Member


Joined: 15 Jul 2011
Points: 1116
Post Options Post Options   Quote BAlheit Quote  Post ReplyReply Direct Link To This Post Posted: 17 Oct 2011 at 10:59am
You can use Zip Code as format:

Back to Top
gkaiseril View Drop Down
Senior Member
Senior Member


Joined: 15 Jul 2011
Location: USA
Points: 4113
Post Options Post Options   Quote gkaiseril Quote  Post ReplyReply Direct Link To This Post Posted: 17 Oct 2011 at 2:49pm
If you access the zip code in another field with JavaScript, you will have to use the 'valueAsString' property to keep the leading zero.
Back to Top
mobius55 View Drop Down
New Member
New Member


Joined: 17 Oct 2011
Location: PA
Points: 6
Post Options Post Options   Quote mobius55 Quote  Post ReplyReply Direct Link To This Post Posted: 17 Oct 2011 at 6:28pm
Thanks to both of you. I had found the zipcode format option, but I'm having the same problem with telephone numbers, i.e. 201-888-0002. Didn't look for a phone number format but I will. Failing that, I'll look up the 'value as string' property, assuming I can use it as a validation code in one way or another.

Much appreciated!
CR
Back to Top
gkaiseril View Drop Down
Senior Member
Senior Member


Joined: 15 Jul 2011
Location: USA
Points: 4113
Post Options Post Options   Quote gkaiseril Quote  Post ReplyReply Direct Link To This Post Posted: 17 Oct 2011 at 6:55pm

Those predefined formats include, behind the scenes, special code for the inputted keystrokes, format, and validation. There is also an option for an arbitrary mask, see help for more information. If none of those work, then you need to write your own scripts using the RegExp object.

Back to Top
mobius55 View Drop Down
New Member
New Member


Joined: 17 Oct 2011
Location: PA
Points: 6
Post Options Post Options   Quote mobius55 Quote  Post ReplyReply Direct Link To This Post Posted: 17 Oct 2011 at 9:53pm
OK, I'll check it out! Thanx again!
Cheers,
CR
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.10
Copyright ©2001-2017 Web Wiz Ltd.

This page was generated in 0.031 seconds.