|
Thanks chrishirist
I think i figured it out using form.elements
this is what i've come up with
function checkform(form,btn)
{
pass = true
for(x=0; x<document.Form1.elements.length; x++)
{
if(document.Form1.elements[x].type == "text")
{
if (!IsNumeric(document.Form1.elements[x].value))
{
NumericErr ="Please enter numeric values only\r"
pass = false
}
//alert(document.Form1.elements[x].name)
//alert(document.Form1.elements[x].value)
}
}
This loops through all form elements be it buttons, or any type of input box.
Ignores any that are not type =text. then checks to see if the value for that box is numeric if it is then, at the end it will display a message and stop the the form beging submitted
Again, im not sure if this is the best method cause i'm basically learning javascript as i go. i.e figure out waht i need to do, then figure out how to do it.
|