We help IT Professionals succeed at work.
Get Started

Need help with field validation in a html page using Javascript

Last Modified: 2012-05-10
I have a webform in html that has 1 field - a number that on submitting the form is passed on to a script to generate a page.  Is there a simple (or not) javascript that can ensure the value entered is a numeric so that a sql error doesn't occur?
html on the page is like this - passes a hidden form value and an entered form value to a script.

<FORM ACTION = ""www.mywebsite.com/test/scriptname" Method="Post">
<input type="hidden" name="type" value="V">
<input type="text" name="productid" maxlength="6">
<input type="submit" value="get product"  name="get product">

If a user enters an alpha character = we get ugly sql errors.
Watch Question
This problem has been solved!
Unlock 2 Answers and 8 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE