aspose file tools
The moose likes HTML, CSS and JavaScript and the fly likes how to take either String or numbers..in textbox Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "how to take either String or numbers..in textbox" Watch "how to take either String or numbers..in textbox" New topic
Author

how to take either String or numbers..in textbox

madhuri kunchala
Ranch Hand

Joined: Mar 30, 2010
Posts: 350
hi,
in my project...in one of the textbox...i need to take either numbers or NULL..im not getting any idea..can anyone help me out..here is my jsp code and js code..

login.jsp



login.js




and i need the output as

L-Acct. No.----> NULL
or
L-Acct. No.----> 123

thanks and waiting for the reply..
madhu.
Chris Baron
Ranch Hand

Joined: Mar 21, 2003
Posts: 1049
Check out the function isNaN() (is not a number).
If isNaN(123) is false, it's a number.
madhuri kunchala
Ranch Hand

Joined: Mar 30, 2010
Posts: 350
hi,
i didnt understand the reply..
Chris Baron
Ranch Hand

Joined: Mar 21, 2003
Posts: 1049
Well you replace everything what's in your outer for-loop with:

If the AccNo must not begin with leading zeros, you can even replace the outer loop with a check for isNaN(chkLocalAccNoStr)

And before that all you check if chkLocalAccNoStr == 'NULL'.
If yes, you return true;
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to take either String or numbers..in textbox
 
Similar Threads
how to validate both check box and textbox field at a time
how to take either single number or double number in textbox
problem in getting values using EL
dont need negative values in textbox
problem in validating multiple radioboxes in JS