i have this code, that gives me the value selected in 2 radio groups (company and people). this code works very well when the 2 radio groups are selected :
========================
var RadioComp_sel="none";
var RadioPep_sel="none";
function GetCurCompSel() {
for (i=0; i<= document.myForm.Company.length; i++) {
if (document.myForm.Company.checked) {
RadioComp_sel = document.myForm.Company.value;
break;
}
}
}
function GetCurPepSel() {
for (i=0; i<= document.myForm.people.length; i++) {
if (document.myForm.people.checked) {
RadioPep_sel = document.myForm.people.value;
break;
}
}
}
GetCurCompSel();
GetCurPepSel();
alert(RadioComp_sel);
alert(RadioPep_sel);
========================
the problem is that when there is at least one of this radio group where nothing is selected, IE tels me that document.myForm.object.checked is not an object.
I know it doesn't exists, thats why there is an IF test in front of this lign. But IE acts as if the "IF" was not there.
What's the bug with my test ?
what can i do if y want to keep the string "none" if one radio group is not selected ?
sorry again for my bad english
- Best regards,
Elise
========================
var RadioComp_sel="none";
var RadioPep_sel="none";
function GetCurCompSel() {
for (i=0; i<= document.myForm.Company.length; i++) {
if (document.myForm.Company.checked) {
RadioComp_sel = document.myForm.Company.value;
break;
}
}
}
function GetCurPepSel() {
for (i=0; i<= document.myForm.people.length; i++) {
if (document.myForm.people.checked) {
RadioPep_sel = document.myForm.people.value;
break;
}
}
}
GetCurCompSel();
GetCurPepSel();
alert(RadioComp_sel);
alert(RadioPep_sel);
========================
the problem is that when there is at least one of this radio group where nothing is selected, IE tels me that document.myForm.object.checked is not an object.
I know it doesn't exists, thats why there is an IF test in front of this lign. But IE acts as if the "IF" was not there.
What's the bug with my test ?
what can i do if y want to keep the string "none" if one radio group is not selected ?
sorry again for my bad english
- Best regards,
Elise