Page 1 of 1

Javascript: EZiest Way To Ref All Form Fields???

Posted: Wed Jan 28, 2004 2:24 pm
by justravis
I want to do something like this to represent all fields:

if(document.form.checkboxes.value='' || document.form.radio.value='' || document.form.text.value='')

Is it possible??? THANK YOU!!!

Posted: Wed Jan 28, 2004 6:32 pm
by Unipus
Not sure what you mean, maybe this, though?

document.forms.getElementsByTagName('*')

although unless it's a very small form, I'd be very careful about using a wildcard like that. You might rather use

document.forms.problem.getElementsByTagName('input')

and so on...