473,586 Members | 2,472 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Number Validation

14 New Member
Hi,

I need to check whether the user has entered a numeric value or not in a text box using Javascript. What function can be used for this?

Thanks in advance.

Regards,
Sivakrupa
Apr 9 '09 #1
3 1469
Dormilich
8,658 Recognized Expert Moderator Expert
you could use isNaN() or the typeof operator.
Apr 9 '09 #2
asivakrupa
14 New Member
That worked out.
Yeah thanks.
Apr 9 '09 #3
acoder
16,027 Recognized Expert Moderator MVP
I would recommend regular expressions, e.g.
Expand|Select|Wrap|Line Numbers
  1. /^-?\d*\.?\d+$/
Apr 10 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
4340
by: Laphan | last post by:
Hi All I'm after a Tax/VAT number validation script that I can tag onto the onClick event of my submit button before submission. I've seen a lot of these as server side, but I'm trying to keep things like this as client-side, as I personally hate having to wait for the submission to go through and then finding I've missed a field off. ...
6
7127
by: simina | last post by:
Hi... I have a form with 4 number fields: phone area, phone number, cell area, cell number. I did a function that checks the "number" issue for all 4 fields in the same time (because the code is onBlur: "return ph(this);"). Now the problem is that if the user hits Enter data still goes to the database (of course, because I should have the...
3
5784
by: tdmailbox | last post by:
What is the proper way to set up a validation rule to only allow numbers? I want to allow both 1024 and 1024.25
2
2909
by: Andy Eshtry | last post by:
I need to validate a textbox control using the validation control so that user can enter only string (character) type not numbers I used comparevalidator and set the "Operator" property to "Datatype check" and "Type" property to "String" but I can enter numbers and this is not I want. Also I used Regular expression validator and set the...
6
1423
by: JIM.H. | last post by:
How can I grantee that user enter only number in the textbox. If possible accept ","and "." in the number. Can I do this?
9
13756
by: campbellwarren | last post by:
Does anyone know how I could limit the number of rows allowed in a MS Access table... want to limit it to 1.
2
3939
by: Jeff | last post by:
hey asp.net 2.0 I have a textbox on my webpage. I want to validate that the user has entered a number and not text. So I added a RegularExpressionValidator to the form, and set its ControlToValidate to my textbox I don't find any predefined validation expressions in the "Regular Expression Editor" which is suitable for this task So I...
2
1704
by: voroojak | last post by:
Hi i just want the user can enter number not any thing else in form. i tried >like "*#*"< in validation validation rule area and it seems that it is working and put just >accept number< in validation text. but the erroe message is teh default one and when i want to clse the window it shows my error message. HELP
19
107915
Frinavale
by: Frinavale | last post by:
Filtering user input is extremely important for web programming. If input is left unfiltered users can input malicious code that can cripple your website. This article will explain how to make sure that the user only submits a number to your .NET web application and also demonstrate how to add JavaScript to your ASPX pages. Upon popular...
0
7915
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7841
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8339
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7965
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6617
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5712
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5392
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3869
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1452
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.