OK, I have a routine that if you “check” a checkbox, the values from the first section are duplicated in the second, uncheck it and they go away awaiting input…everything works OK except for the oddity that if I click a radio button in section1 for Male, check the checkbox, the values change accordinglt BUT the radio button in section2 is selected as Female…if section1 radio is Female, it comes across Female…I even tried a new selection in section2 coded as variable[2] and it was selected correctly…code is as follows:
<SCRIPT LANGUAGE=”JavaScript”>
var CndnOwnFirstName = “$CndnOwnFirstName$”;
var CndnOwnLastName = “$CndnOwnLastName$”;
var CndnOwnStreet = “$CndnOwnStreet$”;
var CndnOwnCity = “$CndnOwnCity$”;
var CndnOwnStProv = “$CndnOwnStProv$”;
var CndnOwnZipPC = “$CndnOwnZipPC$”;
var CndnOwnCountry = “$CndnOwnCountry$”;
var CndnOwnHomePhone = “$CndnOwnHomePhone$”;
var CndnOwnBusPhone = “$CndnOwnBusPhone$”;
var CndnOwnSS = “$CndnOwnSS$”;
var CndnOwnDOB = “$CndnOwnDOB$”;
var CndnOwnEmail = “$CndnOwnEmail$”;
var CndnOwnGender = “$CndnOwnGender$”;
function OwnEqualInsured() {
if (document.forms[0].copy.checked) {
document.forms[0].CndnOwnFirstName.value=document.forms[0].CndnInsFirstName.value;
document.forms[0].CndnOwnLastName.value=document.forms[0].CndnInsLastName.value;
document.forms[0].CndnOwnStreet.value=document.forms[0].CndnInsStreet.value;
document.forms[0].CndnOwnCity.value=document.forms[0].CndnInsCity.value;
document.forms[0].CndnOwnStProv.value=document.forms[0].CndnInsStProv.value;
document.forms[0].CndnOwnZipPC.value=document.forms[0].CndnInsZipPC.value;
document.forms[0].CndnOwnCountry.value=document.forms[0].CndnInsCountry.value;
document.forms[0].CndnOwnHomePhone.value=document.forms[0].CndnInsHomePhone.value;
document.forms[0].CndnOwnBusPhone.value=document.forms[0].CndnInsBusPhone.value;
document.forms[0].CndnOwnSS.value=document.forms[0].CndnInsSS.value;
document.forms[0].CndnOwnDOB.value=document.forms[0].CndnInsDOB.value;
document.forms[0].CndnOwnEmail.value=document.forms[0].CndnInsEmail.value;
if (document.forms[0].CndnInsGender[0].value=”Male”)
document.forms[0].CndnOwnGender[0].checked=true;
if (document.forms[0].CndnInsGender[1].value=”Female”)
document.forms[0].CndnOwnGender[1].checked=true;
}
else {
document.forms[0].CndnOwnFirstName.value=CndnOwnFirstName;
document.forms[0].CndnOwnLastName.value=CndnOwnLastName;
document.forms[0].CndnOwnStreet.value=CndnOwnStreet;
document.forms[0].CndnOwnCity.value=CndnOwnCity;
document.forms[0].CndnOwnStProv.value=CndnOwnStProv;
document.forms[0].CndnOwnZipPC.value=CndnOwnZipPC;
document.forms[0].CndnOwnCountry.value=CndnOwnCountry;
document.forms[0].CndnOwnHomePhone.value=CndnOwnHomePhone;
document.forms[0].CndnOwnBusPhone.value=CndnOwnBusPhone;
document.forms[0].CndnOwnSS.value=CndnOwnSS;
document.forms[0].CndnOwnDOB.value=CndnOwnDOB;
document.forms[0].CndnOwnEmail.value=CndnOwnEmail;
if (document.forms[0].CndnInsGender[0].value=”Male”)
document.forms[0].CndnOwnGender[0].checked=false;
if (document.forms[0].CndnInsGender[1].value=”Female”)
document.forms[0].CndnOwnGender[1].checked=false;
}
}
</script>
At first I thought mabe I put in the letter “O” for the number zero “0” but that wasn’t it…section2 has 4 radio choices Male, Female, Corporate, Other which I reference as [0],[1],[2],[3] respectively…so above when I said I tried a new variable it was [2] and it correctly returned Corporate…pretty stumped at this point…what idiotic error did I make this time?
Thanks,
Ron