By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,701 Members | 1,711 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,701 IT Pros & Developers. It's quick & easy.

Need numeric validation for a field in a form

P: 9
i need to validate the form .. fields should not be empty is justified... but the last field i.e var z should be numeric ..please reply fast

Expand|Select|Wrap|Line Numbers
  1. function validateform()
  2. {
  3. var x=document.getElementById("nameid").value;
  4. if(x==''){alert("name should not be empty");return false;}
  5. var y=document.getElementById("qualificationid").value ;
  6. if(y==''){alert("qualification should not be empty");return false;}
  7. var z=document.getElementById("rollnumid").value;
  8. if(z==''){alert("rollnum should not be empty");return false;}
  9. }
Aug 16 '12 #1
Share this Question
Share on Google+
2 Replies


gits
Expert Mod 5K+
P: 5,390
you might use the isNaN method for that check
Aug 16 '12 #2

ariful alam
100+
P: 185
@satyasampan, you should have a look @ the following link

http://bytes.com/topic/php/answers/9...ry#post3725937

Hope works for you. :)
Aug 16 '12 #3

Post your reply

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