Hi, i have a form with multiple inputs, i need to validate before submitting that the sum of all inputs has to be greater than 0. my form will look something like this. <form name="form" etc...> <input type='text' name='qty1$uniq_ID' value='0' size='1' maxlength='3' /> <input type='text' name='qty2$uniq_ID' value='0' size='1' maxlength='3' /> </form> Code (markup): how should i proceed?
I prefer to use the ID on input elements to identify them. Assuming that, do something like this: field1 = document.getElementById("qty1"); field2 = document.getElementById("qty2"); if ( field1.value + field2.value > 0 ) { form.submit(); }