I would like to add all the numbers entered into the text boxes.Compare it with another number say max =10.
If true submit if not do not submit.
Number of text boxes changes every time and they are created when certain “if statements” are true and thus each textbox’s name is different.Eg one could be window another could be door.
What I would like is this:
for all text boxes in the form (does not matter how many)
get their number values (user enters a number)
if any one value is null (means user did not enter anything at all)
display error message
else add all values up (assign it to total)
if total is equal or less than max (in this case, it is 10)
then return true on submit
else return false on submit
I am relatively new at this thing. I cannot hardcode because the number of text boxes changes every time with different names.
How do I write a javascript to get all the values in the text boxes in that form using a looping function?
How would I write this at onSubmit=”????” also?
Hope someone can provide an example for me.
Thanks a million.Appreciate all your help