I have a form with a bunch of <select> fields, and each has an onChange=”HandleChange();” and HandleChange is a very simple function that looks like this:
function HandleChange() {
parent.document.location.href=”vendor_ranking_frames.asp?viewAcctMngr=” + document.forms[0].acctMngr.value + “&viewBlahBlah=” + document.forms[0].BlahBlah.value;
}
Except there are several more &viewBlahBlah’s in there because there are lots of <select> fields.
Now, I need to add a checkbox to this form, and I need it to trigger the same HandleChange function. Here is where I’m having trouble. I’ve been using onClick=”HandleChange();” (because onChange doesn’t seem to do it with checkboxes), and it does trigger the function, but it’s not passing the value I want it to pass. By default, the checkbox is unchecked and thus its value is “unchecked”. But when I check it and HandleChange is triggered, it’s still passing “unchecked” through … when I want it to pass its new value, “checked”, through. Incongruous with the <select> fields, which by default are set to value “all” but when I change one to “BS” it passes “BS” through. To further illustrate, here’s exactly what’s going on [edited for length and to fit your screen]:
function HandleChange() {
parent.document.location.href=”vendor_ranking_frames.asp?viewAcctMngr=” + document.forms[0].acctMngr.value + “&viewIS_Filter=” + document.forms[0].IS_Filter.value;
}
<SELECT NAME=”acctMngr” SIZE=”1″ ONCHANGE=”HandleChange();”>
<option value=”all” selected>ALL</option>
<OPTION VALUE=”BS”>BS</OPTION>
</SELECT>
<input type=”checkbox” name=”IS_Filter” value=”unchecked” onClick=”HandleChange();”>
When I make a change to the select dropdown (selecting BS from the default “ALL”), HandleChange is triggered and the address bar looks like this:
vendor_ranking_frames.asp?viewAcctMngr=BS&viewIS_Filter=unchecked
But when I make a change to the checkbox (checking it, from its default of being unchecked), HandleChange is triggered and the address bar looks like this:
vendor_ranking_frames.asp?viewAcctMngr=all&viewIS_Filter=unchecked
What should I do to make it pass “viewIS_Filter=checked” ? Catch my drift? ?
Thanks….