southbeach
Programmer
I have a script
I am trying to use the same function from multiple pages where the form has different name.
I was hoping that using above code method would work but I get the obvious error "document.forms.formname is undefined"
What must I do to be able to use a variable in lieu of literally typing the name of the form itself?
Thank you all in advance for your assistance!
--
SouthBeach
The good thing about not knowing is the opportunity to learn - Yours truly, 2008.
Code:
function postComments(formname,id) {
var msg='';
if (document.forms.formname.aTextArea.value == '') msg = 'Please fill in comments.\n';
if (document.forms.fiformnamele.gotChaString.value == '') { msg = msg + 'Please fill in 5 digits.\n'; }
var comments = document.forms.formname.aTextArea.value;
var gotCha = document.forms.formname.gotChaString.value;
I am trying to use the same function from multiple pages where the form has different name.
I was hoping that using above code method would work but I get the obvious error "document.forms.formname is undefined"
What must I do to be able to use a variable in lieu of literally typing the name of the form itself?
Thank you all in advance for your assistance!
--
SouthBeach
The good thing about not knowing is the opportunity to learn - Yours truly, 2008.