Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form validation

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
0
0
Hello,

I am trying to validate a form to make certain that any number input is in increments 1000. You knonw, no less then 1000 but must be 1000,2000,3000,4000 and so on.

Can somebody help me with this
 
example
a=9000 % 1000;

a will then = 0. If it is anything else then it is not an increment of 1000;
 
if (parseInt(myForm.myField.value) % 1000 != 0 ) {
alert("Form value is not a multiple of 1000");
return false;
} Mise Le Meas,

Mighty :)
 
You might want to add a myForm.myField.focus() to Mighty's function, just for extra functionality! "The surest sign that intelligent life exists elsewhere in the universe is that it has never tried to contact us"
Bill Watterson, Calvin & Hobbes
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top