Changing appearance of form elements

admin

Administrator
Staff member
Hello!
I have a form on my page with several elements.
I want to disable/enable a text box and radio buttons
and clear the values in the text box/reset the radio buttons on the click a different radio button.

I thought it would be quicker to put the names of the form element in an array and loop through them.

The extract of my code below works for the text box but not the radio button.

Can anyone let me know where I'm going wrong please?:confused:


Code:

var aryGrpB = ["txtArchFolder","radCopy[1]","radCopy[2]"];

//for every value in Grp array enable element
for ( var i = 0 ; i < aryGrpB.length ; i++ ) {
document.frm1[aryGrpB].disabled = true;}

//for every value in Grp array clear value
for ( var i = 0 ; i < aryGrpB.length ; i++ ) {
document.frm1[aryGrpB].value = '';}
 
Back
Top