File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes validating that field has a number Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "validating that field has a number" Watch "validating that field has a number" New topic

validating that field has a number

Lauren Pender

Joined: Jun 15, 2001
Posts: 5
I would like to validate in javascript that the text entered in a field is a number.
Dave Vick
Ranch Hand

Joined: May 10, 2001
Posts: 3244
use this test
if (isNaN(document.formName.fieldName.value))
if it returns true then the value in the field is not a number.
hope that helps
[This message has been edited by Dave Vick (edited June 19, 2001).]

I agree. Here's the link:
subject: validating that field has a number
Similar Threads
cant log on to certmanager
sql query
where to check the length instance variable for an Array
key field is record number or flight number?
Adding row dynamically and sending all rows value to servlet