Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A text box that holds only ints ? 2

Status
Not open for further replies.

neillovell

Programmer
Aug 27, 2002
560
GB

<input type=&quot;text&quot; name=&quot;RowIDField&quot; size=&quot;4&quot; >

this is causing me problems in accessing my database because I am filtering using the autonumbers field. With this text box being text, the computer claims there's a mismatch in data types. How do I create a box that users input only numbers in to?
 
An example of allowing only numerical input can be found at xutopia's site:

Of course, as it's a text input, the value will still be a text field, so you'll probably need to convert it.
value=parseInt(value);
will convert it to an integer.
Also, if you're using ASP, don't surround the variable with ' ' in your SQL statement as it will then consider it as text again.
 
Oh in my SQL statement I had '' around the value, which was wrong. I looked up the parseInt function, and that didn't work (because of the '') - silly me!

Thanks for responding!!!!!!!!!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top