Forum Moderators: open

Message Too Old, No Replies

Dynamic Dropdowns

         

RussellC

4:09 pm on Oct 11, 2004 (gmt 0)

10+ Year Member



I have a script in PHP to add callers. It has a drop down for "Lead" or where they found us. When Partner is selected from the dropdown, it makes another field show up under it to select the partner. It also does this for another option. It does this with hidden divs with this script:

function showDropDownBox(ddbox) {
if ( ddbox.options[ddbox.selectedIndex].value == "Partner" ) {
document.getElementById("partner1").style.display = "inline";
} else {
document.getElementById("partner1").style.display = "none";
}

if ( ddbox.options[ddbox.selectedIndex].value == "Other" ) {
document.getElementById("other1").style.display = "inline";
} else {
document.getElementById("other1").style.display = "none";
}
}
</script>

It all works fine when you add a new call. But I also have a page to edit the call. When I try a similar script on the edit page it does not work correctly because "Partner" is already selected in the dropdown where the page is loaded. Is there any way to make it work so when I load the edit page the "Partner" field is there and if I select a different option it goes away. And if I select the "Other" field it does the same thing. Am I making sense? Thanks

RussellC

3:47 pm on Oct 14, 2004 (gmt 0)

10+ Year Member



I guess I didnt make myself clear. ANyone need a better explanation. I am still trying to get this to work.

Thanks