i’m trying to include additional (looping) functionality to some code worked out on this thread: [URL=”http://www.webdeveloper.com/forum/showthread.php?p=1065718#post1065718″]http://www.webdeveloper.com/forum/showthread.php?p=1065718#post1065718
the client added some choices to the form, so now i need to disable certain choices after an initial selection, then further narrow the choices based on the next selection. so i’ve created a second function, similar to the one on the prev. thread, called AttDisab:
[CODE]function AttDisab (val) {
this.d = function(el){
el.disabled=true;
el.checked=false;
if(el.parentNode.tagName == “label”)el.parentNode.className = ‘disabled’;}
this.en = function(el){
el.disabled=false;
if(el.parentNode.tagName == “label”)el.parentNode.className = ‘enabled’;
}
if(val===0){
en(document.OPHAConfReg.RegType[0]);
en(document.OPHAConfReg.RegType[1]);
en(document.OPHAConfReg.RegType[2]);
en(document.OPHAConfReg.RegType[3]);
d(document.OPHAConfReg.RegType[4]);
d(document.OPHAConfReg.RegType[5]);
d(document.OPHAConfReg.RegType[6]);
d(document.OPHAConfReg.RegType[7]);
}
if(val===1){
en(document.OPHAConfReg.RegType[4]);
en(document.OPHAConfReg.RegType[5]);
en(document.OPHAConfReg.RegType[6]);
en(document.OPHAConfReg.RegType[7]);
d(document.OPHAConfReg.RegType[0]);
d(document.OPHAConfReg.RegType[1]);
d(document.OPHAConfReg.RegType[2]);
d(document.OPHAConfReg.RegType[3]);
document.OPHAConfReg.RegType[4].disabled=false;
document.OPHAConfReg.RegType[5].disabled=false;
document.OPHAConfReg.RegType[6].disabled=false;
document.OPHAConfReg.RegType[7].disabled=false;
document.OPHAConfReg.RegType[0].checked=false;
document.OPHAConfReg.RegType[0].disabled=true;
document.OPHAConfReg.RegType[1].checked=false;
document.OPHAConfReg.RegType[1].disabled=true;
document.OPHAConfReg.RegType[2].checked=false;
document.OPHAConfReg.RegType[2].disabled=true;
document.OPHAConfReg.RegType[3].checked=false;
document.OPHAConfReg.RegType[4].disabled=true;
}
}
for this section of the form (all unecessary form element stripped in this example):
[code=html]<form id=”OPHAConfReg” name=”OPHAConfReg”>
<label>
<input value=”0″ type=”radio” name=”Attendance” id=”Attendance[0]” onclick=”AttDisab(0)” />
I will be travelling to the conference</label>
<br />
<label>
<input value=”1″ type=”radio” name=”Attendance” id=”Attendance[0]2″ onclick=”AttDisab(1)” />
I will be travelling to the conference</label>
<hr />
<label for=”RegType[0]”>
<input value=”RegMem” type=”radio” name=”RegType” id=”RegType[0]” onclick=”Disab(0)” disabled=”disabled” />
Regular Member</label>
<br />
<label for=”RegType[1]”>
<input value=”RegNonMem” type=”radio” name=”RegType” id=”RegType[1]” onclick=”Disab(1)” disabled=”disabled” />
Regular Non-member</label>
<br />
<label for=”RegType[2]”>
<input value=”StuMem” type=”radio” name=”RegType” id=”RegType[2]” onclick=”Disab(2)” disabled=”disabled” />
Student Member</label>
<br />
<label for=”RegType[3]”>
<input value=”StuNonMem” type=”radio” name=”RegType” id=”RegType[3]” onclick=”Disab(3)” disabled=”disabled” />
Student Non-Member
</label>
<hr />
<label for=”RegType[4]”>
<input value=”RegMem” type=”radio” name=”RegType” id=”RegType[4]” disabled=”disabled” />
Regular Member</label>
<br />
<label for=”RegType[5]”>
<input value=”RegNonMem” type=”radio” name=”RegType” id=”RegType[5]” disabled=”disabled” />
Regular Non-member</label>
<br />
<label for=”RegType[6]”>
<input value=”StuMem” type=”radio” name=”RegType” id=”RegType[6]” disabled=”disabled” />
Student Member</label>
<br />
<label for=”RegType[7]”>
<input value=”StuNonMem” type=”radio” name=”RegType” id=”RegType[7]” disabled=”disabled” />
Student Non-Member </label>
<input value=”Submit Form” type=”submit” />
<input value=”Clear Form” type=”reset” />
</form>
[LIST=1][*]
Why is the CSS not being applied?
Why is the second instance of Regular Member (RegType[4]) always disabled?
Thanks in advance,
–cz