Is there anyway I can check to see if my user is submitting a number or not,? There is a textbox, and they are asked to enter a number into it, but I don't know how to verify if they entered one or not. Any help is welcome.
Odds are you don't know programming. Why do you need to check? If they submit the data, you should be able to get in the server side.
on your form tag (<form>) you can add the onsubmit attribute.. <form onsubmit="return validate(this);" ... > HTML: then you can add this script.. <script type="text/javascript"> function validate(form) { var numfield = form.NumberFieldName.value; if(isNaN(numfield)) { // add a notification here, say: alert("You entered an invalid number."); return false; } else return true; } </script> HTML:
I do know "programming"... But that doesn't mean I know every language. And I want to do it in javascript because the page that they are taken to after the forum is submitted redirects them to another site.
Hugocub, One suggestion for you, if you are making use of user entered data on sever, you should not rely on only java script validation, because javascript can be disabled in browser. You should validate user entered data on server side as well. If you need any help in that i can help you. Sheetal
There is a function isNaN Which Stands for is Not a Number So You can check isNaN(document.getElementById("fieldid"))==false
You could also just not allow anything but 0-9 in that textbox (using Javascript in an onKeyUp function) then test for the textbox being blank before submitting.