View Full Version : Chained Selects Using 2 Groups

05-04-2018, 03:19 PM
1) Script Title: Chained Selects

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex16/chainedselects/index.htm

3) Describe problem: I would like to use 2 different list groups on the same page. I have verified each group works separately, but when combined, only the first works and the second group remains empty.

<body onload="initListGroup('Reports0', document.forms[0].location0, document.forms[0].id0); initListGroup('Reports2', document.forms[0].location2, document.forms[0].id2)">

<form method="post" action="test1.asp" name="formNavigation">
<script language="javascript">
var hide_empty_list=false;
addListGroup("Reports0", "Report0");
addList("Report0", "Select A Course", "0");
addList("Report0", "Marijuana Overview (Course ID: 9119)", "1", "ID 0-1");
addList("Report0", "Mental Health Parity Act of 2018 (Course ID: 2105)", "3", "ID 0-3");
addList("Report0", "Therapeutic Communities (Course ID: 1261)", "2", "ID 0-2");

addOption("ID 0-1", "Additional Course Information", "0");
addOption("ID 0-1", "Pay for Course", "1");
addOption("ID 0-2", "Additional Course Information", "0");
addOption("ID 0-2", "Start Course", "2");
addOption("ID 0-3", "Additional Course Information", "0");

addListGroup("Reports2", "Report2");
addList("Report2", "Select A Course", "0");
addList("Report2", "Restart...your health in just 5 weeks! (Course ID: 14325)", "1", "ID 2-1");

addOption("ID 2-1", "Additional Course Information", "0");
addOption("ID 2-1", "Pay for Course", "1");
<select name="location0"></select><br>
<select name="id0"></select><br>
<select name="location2"></select><br>
<select name="id2"></select><br>
<input type="submit" name="b1" value="Process Online Course Request">