client side dynamic dependent list box

A

Amp Inthalangsy

Hi there,

Was hoping someone would have an fix for me or some kind or work around. I
was able to get my client side dynamic dependent list box working but if
my child list data has double quotes or hard breaks as values it wont work
at all and I am getting a "underterminated string constant" error.

If anyone can help please email me at: (e-mail address removed)

thanks in andvance
 
A

Amp Inthalangsy

<!--

var arrDynaList = new Array();
var arrDL1 = new Array();

arrDL1[1] = "personal_category"; // Name of parent list box
arrDL1[2] = "form1"; // Name of form containing parent list box
arrDL1[3] = "dropdownbox"; // Name of child list box
arrDL1[4] = "form1"; // Name of form containing child list box
arrDL1[5] = arrDynaList; // No need to do anything here

<%
Dim txtDynaListRelation, txtDynaListLabel, txtDynaListValue, oDynaListRS

txtDynaListRelation = "category" ' Name of recordset field relating to
parent
txtDynaListLabel = "label" ' Name of recordset field for child Item
Label
txtDynaListValue = "comment" ' Name of recordset field for child Value
Set oDynaListRS = personalcomments ' Name of child list box recordset

Dim varDynaList
varDynaList = -1

Dim varMaxWidth
varMaxWidth = "1"

Dim varCheckGroup
varCheckGroup = oDynaListRS.Fields.Item(txtDynaListRelation).Value

Dim varCheckLength
varCheckLength = 0

Dim varMaxLength
varMaxLength = 0

While (NOT oDynaListRS.EOF)

If (varCheckGroup <> oDynaListRS.Fields.Item(txtDynaListRelation).Value)
Then
If (varCheckLength > varMaxLength) Then
varMaxLength = varCheckLength
End If
varCheckLength = 0
End If
%>
arrDynaList[<%=(varDynaList+1)%>] =
"<%=(oDynaListRS.Fields.Item(txtDynaListRelation).Value)%>"
arrDynaList[<%=(varDynaList+2)%>] =
"<%=(oDynaListRS.Fields.Item(txtDynaListLabel).Value)%>"
arrDynaList[<%=(varDynaList+3)%>] =
"<%=(oDynaListRS.Fields.Item(txtDynaListValue).Value)%>"
<%
If (len(oDynaListRS.Fields.Item(txtDynaListLabel).Value) >
len(varMaxWidth)) Then
varMaxWidth = oDynaListRS.Fields.Item(txtDynaListLabel).Value
End If
varCheckLength = varCheckLength + 1
varDynaList = varDynaList + 3
oDynaListRS.MoveNext()
Wend

If (varCheckLength > varMaxLength) Then
varMaxLength = varCheckLength
End If
%>

//-->
</script>
<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){
oList[oList.length]= new Option("Please Select");
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 == 1){
oList.options[oList.options.length] = new Option("No personal comments for
this category");
}
oList.selectedIndex = 0;
}

//-->
</script>
 
R

Raffaele Rialdi [MVP]

Amp Inthalangsy wrote:
[...]

I doesn't make any sense that you crosspost in newsgroup of different
languages.
For example in microsoft.public.it.dotnet.asp you should post into Italian
language!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top