Ask a Question related to Dreamweaver AppDev, Design and Development.
-
ukjooles #1
Parent child dynamic lists`
Hi
I am trying to create two dynamic list boxes where one is dependent on the
other. I have used the code on the Macromedia site
([url]http://www.macromedia.com/cfusion/knowledgebase/index.cfm?id=tn_19117[/url]) for
the parent child relationship but am getting the following error message.
Error Type:
Microsoft VBScript compilation (0x800A0401)
Expected end of statement
/newccj/admin/TMP7troag8472.asp, line 27, column 72
var txtDynaListRelation, txtDynaListLabel, txtDynaListValue, oDynaListRS;
Does anyone have any suggestions on where I am going wrong. Thanks
I have made the changes as described in the article and attached the code
below:
<!-- Dynamic Dependent List box Code for *** JavaScript *** Server Model //-->
<script language="JavaScript">
<!--
var arrDynaList = new Array();
var arrDL1 = new Array();
arrDL1[1] = "
company
"; // Name of parent list box
arrDL1[2] = "
AddJob
"; // Name of form containing parent list box
arrDL1[3] = "
recruiter
"; // Name of child list box
arrDL1[4] = "
AddJob
"; // Name of form containing child list box
arrDL1[5] = arrDynaList;
<%
var txtDynaListRelation, txtDynaListLabel, txtDynaListValue, oDynaListRS;
txtDynaListRelation = "
CompanyID
" // Name of recordset field relating to parent
txtDynaListLabel = "
Firstname
" // Name of recordset field for child Item Label
txtDynaListValue = "
UserID
" // Name of recordset field for child Value
oDynaListRS =
rsRecruiter
// Name of child list box recordset
var varDynaList = -1;
var varMaxWidth = "1";
var varCheckGroup = oDynaListRS.Fields.Item(txtDynaListRelation).Value ;
var varCheckLength = 0;
var varMaxLength = 0;
while (!oDynaListRS.EOF){
if (varCheckGroup != oDynaListRS.Fields.Item(txtDynaListRelation).Value ) {
varMaxLength = Math.max(varCheckLength, varMaxLength)
varCheckLength = 0;
}
%>
arrDynaList[<%=(varDynaList+1)%>] =
"<%=(oDynaListRS.Fields.Item(txtDynaListRelation). Value)%>";
arrDynaList[<%=(varDynaList+2)%>] =
"<%=(oDynaListRS.Fields.Item(txtDynaListLabel).Val ue)%>";
arrDynaList[<%=(varDynaList+3)%>] =
"<%=(oDynaListRS.Fields.Item(txtDynaListValue).Val ue)%>";
<%
if (oDynaListRS.Fields.Item(txtDynaListLabel).Value.l ength >
varMaxWidth.length) {
varMaxWidth = oDynaListRS.Fields.Item(txtDynaListLabel).Value;
}
varCheckLength = varCheckLength + 1;
varDynaList = varDynaList + 3;
oDynaListRS.MoveNext();
}
varMaxLength = Math.max(varCheckLength, varMaxLength)
%>
//-->
</script>
<!-- End of object/array definitions, beginning of generic functions -->
<script language="JavaScript">
<!--
function setDynaList(arrDL){
var oList1 = document.forms[arrDL[2]].elements[arrDL[1]]
var oList2 = document.forms[arrDL[4]].elements[arrDL[3]]
var arrList = arrDL[5]
clearDynaList(oList2);
if (oList1.selectedIndex == -1){
oList1.selectedIndex = 0;
}
populateDynaList(oList2, oList1[oList1.selectedIndex].value, arrList);
return true;
}
function clearDynaList(oList){
for (var i = oList.options.length; i >= 0; i--){
oList.options = null;
}
oList.selectedIndex = -1;
}
function populateDynaList(oList, nIndex, aArray){
for (var i = 0; i < aArray.length; i= i + 3){
if (aArray == nIndex){
oList.options[oList.options.length] = new Option(aArray[i + 1], aArray[i +
2]);
}
}
if (oList.options.length == 0){
oList.options[oList.options.length] = new Option("[none available]",0);
}
oList.selectedIndex = 0;
}
//-->
</script>
ukjooles Guest
-
Parent/Child relations - Trying to access child control for save
I have a parent datagrid that has my customer information. For each customer I have a child datagrid with all their part information. In the... -
removing a child from a parent
is it possible to remove a child from a parent WITHOUT removing it from the world? if I set its parent to VOID it removes it from the world. I want... -
Parent/Child Relationship
Using VS 2003, VB.NET, sql msde... This is really a question about a winform datagridcontrol (if there is a better newsgroup for these winform... -
Transferring from parent to child
I was given some direction about a loop step, but I need help with step syntax within the loop. The following is what I have so far, it presently... -
Child & Parent forms
Hi, I have parent-form that displays a list of product-details. When the user clicks on a line a child form opens that displays further...



Reply With Quote

