Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
input validation for numeric only ? using javascript
Old 05-23-2010, 09:01 PM input validation for numeric only ? using javascript
Junior Talker

Posts: 2
Name: ari candra wijaya
Trades: 0
Hi there,


I am making an order form for sell an item on internet, now i have to create frame for this form e.g name, email, phone, product code, so on .

But now i have some problem , there are how to making simple input validation for numeric only so if the buyer type some letter and it not numeric type it will show an error / alert message .


Do you want to teach me how to do it ?

FYI i am using external script / different directory .

thank you in advance
Nightwave is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-25-2010, 07:28 AM Re: input validation for numeric only ? using javascript
Experienced Talker

Posts: 46
Name: Maneet Puri
Trades: 0
Hi,

Search “java script form validations “ on Google and you will get lot of scripts that you can use.

Also go to w3schools.com it a good tutorials website for beginners.

Cheers,

~Maneet
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
maneetpuri is offline
Reply With Quote
View Public Profile
 
Old 05-26-2010, 09:50 AM Re: input validation for numeric only ? using javascript
Extreme Talker

Posts: 246
Trades: 0
You can do this one of 2 ways. Show an error message, or don't allow anything but numbers. I prefer to just not allow anything except numbers.

http://www.htmlcodetutorial.com/form...msupp_158.html
or
http://www.cambiaresearch.com/c4/029...a-TextBox.aspx
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
stbuchok is offline
Reply With Quote
View Public Profile
 
Old 05-26-2010, 10:57 AM Re: input validation for numeric only ? using javascript
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
isNaN() is your friend.
https://developer.mozilla.org/en/Cor...isNaN_Function
Code:
formValue=document.getElementById('inputField').value;
if(isNaN(formValue)===true){
  alert('please input only numbers!');
}
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 05-28-2010, 08:38 PM Re: input validation for numeric only ? using javascript
Junior Talker

Posts: 2
Name: ari candra wijaya
Trades: 0
thank you brother ... i love this forum

thanks . it's very helpful
Nightwave is offline
Reply With Quote
View Public Profile
 
Old 06-10-2010, 09:00 AM Re: input validation for numeric only ? using javascript
Junior Talker

Posts: 1
Name: eliza sahoo
Trades: 0
Basicallly When we trying to validate a form some time we need numeric validation for textbox.

We can validate textbox by onkeypress event of the control By checking whether the keycode of the key pressed as the user types falls within the range of the number keys 48-57(i.e 0-9 and '.') ,if not belong to that range it will return false then it will disable the keypress action
function NumericValidation(eventObj)
{
var keycode;

if(eventObj.keyCode) //For IE
keycode = eventObj.keyCode;
else if(eventObj.Which)
keycode = eventObj.Which; // For FireFox
else
keycode = eventObj.charCode; // Other Browser

link drop removed

Last edited by chrishirst; 06-12-2010 at 06:23 PM..
eliza81 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to input validation for numeric only ? using javascript
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.23145 seconds with 12 queries