...

View Full Version : dependent list boxes problem



suryc_ezra
03-29-2006, 11:51 AM
hi all,

i have 4 dependent list boxes namely:
1. company name
2. project name
3. part no.
4. part name <<< problem is here..

everything works fine when the total record in the part table is less than 100. but when it reached to 100 above then the problem will come out and part name listbox won't display all the part names from the database. it took me days to find the solution for this problem but i haven't found one. pls help! thanks in advance.


here is the code:

<%
dim rs
dim sql
dim count
dim rs2
dim sql2
dim count2
dim rs3
dim sql3
dim count3
sql = "select distinct project_name,customer_id from project "

openrs rs, sql
%>
<script language = "JavaScript">
var onecount;
onecount=0;
subcat = new Array();
<%
count = 0
do while not rs.eof
%>
subcat[<%=count%>] = new Array("<%= trim(rs("project_name"))%>","<%= trim(rs("customer_id"))%>","<%= trim(rs("project_name"))%>");
<%
count = count + 1
rs.movenext
loop
rs.close
set rs=nothing
%>
onecount=<%=count%>;

function changelocation(customer_id)
{
document.AccountMaint.project_name.length = 0;
document.AccountMaint.part_no.length = 0;
document.AccountMaint.part_name.length = 0;
var customer_id=customer_id;
var i;
document.AccountMaint.project_name.options[0] = new Option('--- Project Name ---','');
document.AccountMaint.part_no.options[0] = new Option('--- Part No. ---','');
document.AccountMaint.part_name.options[0] = new Option('--- Part Name ---','');
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == customer_id)
{
document.AccountMaint.project_name.options[document.AccountMaint.project_name.length] = new Option(subcat[i][0], subcat[i][2]);
}
}

}
</script>

<%sql2 = "select distinct part_no,project_name from part "

openrs rs2,sql2
%>
<script language = "JavaScript">
var onecount2;
onecount2=0;
subcat2 = new Array();
<%
count2 = 0
do while not rs2.eof
%>
subcat2[<%=count2%>] = new Array("<%= trim(rs2("part_no"))%>","<%= trim(rs2("project_name"))%>","<%= trim(rs2("part_no"))%>");
<%
count2 = count2 + 1
rs2.movenext
loop
rs2.close
set rs2=nothing
%>
onecount2=<%=count2%>;

function changelocation2(project_name)
{
document.AccountMaint.part_no.length = 0;
document.AccountMaint.part_name.length = 0;
var project_name=project_name;
var j;
document.AccountMaint.part_no.options[0] = new Option('--- Part No. ---','');
document.AccountMaint.part_name.options[0] = new Option('--- Part Name ---','');
for (j=0;j < onecount2; j++)
{
if (subcat2[j][1] ==project_name)
{
document.AccountMaint.part_no.options[document.AccountMaint.part_no.length] = new Option(subcat2[j][0],subcat2[j][2]);

}
}

}
</script>

<%sql3 = "select * from part order by part_name asc"

openrs rs3,sql3
%>
<script language = "JavaScript">
var onecount3;
onecount3=0;
subcat3 = new Array();
<%
count3 = 0
do while not rs3.eof
%>
subcat3[<%=count3%>] = new Array("<%= trim(rs3("part_name"))%>","<%= trim(rs3("part_no"))%>","<%= trim(rs3("part_name"))%>");
<%
count3 = count3 + 1
rs3.movenext
loop
rs3.close
set rs3=nothing
%>
onecount3=<%=count3%>;

function changelocation3(part_no)
{

document.AccountMaint.part_name.length = 0;

var part_no=part_no;
var k;
document.AccountMaint.part_name.options[0] = new Option('--- Part Name ---','');
for (k=0;k < onecount3; k++)
{
if (subcat3[k][1] ==part_no)
{

document.AccountMaint.part_name.options[document.AccountMaint.part_name.length] = new Option(subcat3[k][0],subcat3[k][2]);

}
}

}
</script>

degsy
03-29-2006, 04:16 PM
Check if the PartName has speacial characters in the name such as ' or "



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum