Greetings,
I have a nagging problem with client-side dynamic dependent list boxes that perhaps someone can help me troubleshoot.
I have a form with a series of dynamic dependent list boxes. Making a selection from list/box A (Qtr) selects a fiscal quarter, which then refreshes the values in list/box B (Mth), which shows the 3 months in that fiscal quarter, which then refreshes the values in list/box C (MthDate), which returns the date values for that month (e.g., 1-30).
My problem is that making the selection from list A correctly refreshes the values in list B but not with list C. Only when I physically change the option value in list B does list C refresh, but I would expect the list C values to refresh automatically when the onChange event fires upon making a selection in list A.
Here's the JavaScript code: - <!-- Dynamic Dependent List box Code for *** VBScript *** Server Model //--><script language="JavaScript"><!--
-
var arrDynaList2 = new Array();
-
var arrDL2 = new Array();
-
arrDL2[1] = "Qtr"; // Name of parent list box
-
arrDL2[2] = "form1"; // Name of form containing parent list box
-
arrDL2[3] = "Mth"; // Name of child list box
-
arrDL2[4] = "form1"; // Name of form containing child list box
-
arrDL2[5] = arrDynaList2;
-
<%
-
Dim txtDynaListRelation2, txtDynaListLabel2, txtDynaListValue2, oDynaListRS2
-
txtDynaListRelation2 = "Qtr" ' Name of recordset field relating to parent
-
txtDynaListLabel2 = "Mth_Label" ' Name of recordset field for child Item Label
-
txtDynaListValue2 = "Mth" ' Name of recordset field for child Value
-
Set oDynaListRS2 = QtrMth ' Name of child list box recordset
-
Dim varDynaList2
-
varDynaList2 = -1
-
Dim varMaxWidth2
-
varMaxWidth2 = "1"
-
Dim varCheckGroup2
-
varCheckGroup2 = oDynaListRS2.Fields.Item(txtDynaListRelation2).Value
-
Dim varCheckLength2
-
varCheckLength2 = 0
-
Dim varMaxLength2
-
varMaxLength2 = 0
-
While (NOT oDynaListRS2.EOF)
-
If (varCheckGroup2 <> oDynaListRS2.Fields.Item(txtDynaListRelation2).Value) Then
-
If (varCheckLength2 > varMaxLength2) Then
-
varMaxLength2 = varCheckLength2
-
End If
-
varCheckLength2 = 0
-
End If
-
%>
-
arrDynaList2[<%=(varDynaList2+1)%>] = "<%=(oDynaListRS2.Fields.Item(txtDynaListRelation2).Value)%>"
-
arrDynaList2[<%=(varDynaList2+2)%>] = "<%=(oDynaListRS2.Fields.Item(txtDynaListLabel2).Value)%>"
-
arrDynaList2[<%=(varDynaList2+3)%>] = "<%=(oDynaListRS2.Fields.Item(txtDynaListValue2).Value)%>"<%
-
If (len(oDynaListRS2.Fields.Item(txtDynaListLabel2).Value) > len(varMaxWidth2)) Then
-
varMaxWidth2 = oDynaListRS2.Fields.Item(txtDynaListLabel2).Value
-
End If
-
varCheckLength2 = varCheckLength2 + 1
-
varDynaList2 = varDynaList2 + 3
-
oDynaListRS2.MoveNext()
-
Wend
-
If (varCheckLength2 > varMaxLength2) Then
-
varMaxLength2 = varCheckLength2
-
End If
-
%>
-
-
var arrDynaList = new Array();
-
var arrDL1 = new Array();
-
arrDL1[1] = "Mth"; // Name of parent list box
-
arrDL1[2] = "form1"; // Name of form containing parent list box
-
arrDL1[3] = "Day"; // Name of child list box
-
arrDL1[4] = "form1"; // Name of form containing child list box
-
arrDL1[5] = arrDynaList;<%
-
Dim txtDynaListRelation, txtDynaListLabel, txtDynaListValue, oDynaListRS
-
txtDynaListRelation = "CategoryID" ' Name of recordset field relating to parent
-
txtDynaListLabel = "MthDate" ' Name of recordset field for child Item Label
-
txtDynaListValue = "MthDate" ' Name of recordset field for child Value
-
Set oDynaListRS = MthDate ' 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><!-- 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[i] = null;
-
}
-
oList.selectedIndex = -1;
-
}
-
function populateDynaList(oList, nIndex, aArray){
-
for (var i = 0; i < aArray.length; i= i + 3){
-
if (aArray[i] == 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("Please Select",0);
-
}
-
oList.selectedIndex = 0;
-
}
-
function MM_callJS(jsStr) { //v2.0
-
return eval(jsStr)
-
}
-
//-->
-
//--></script>
Here also is the body onload code... - <body onload="MM_callJS('setDynaList(arrDL2)');MM_callJS('setDynaList(arrDL1)')">
...and the list/menu on change codes... - <select name="Qtr" onchange="MM_callJS('setDynaList(arrDL2)')">
- <select name="Mth" id="Mth" onchange="MM_callJS('setDynaList(arrDL1)')">
Whatever help someone can offer would be greatly appreciated.
Regards,
j
1 2963
PROBLEM RESOLVED. I figured out what the problem was. I'd omitted on onChange event in list A for list C. It now works as designed
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: David |
last post by:
Hi,
This is the first time I use SOAP. Dont really know the exact picture
yet. Hope you can shed some lights on me.
May I know where should I start troubleshooting if I get the followin
error message when running SOAP on Windows 2003, SQL Server 2000 ?
Error Code: 0 Error Source= Microsoft VBScript runtime error Error
|
by: Robert A Riedel |
last post by:
I am completely baffled when the following managed exception is thrown:
"Object reference not set to an instance of an object" from a nested
subroutine when referencing a variable allocated on the program stack.
Given the following simple example:
void T( System::String * S )
{
const wchar_t __pin * pchars PtrToStringChars( S ) ;
|
by: Lori McDonald |
last post by:
I am logging errors in my web application in a database for troubleshooting (and emailing them to myself) and I am getting this error I cannot understand
I have a click event that is generating an "Object reference not set to instance of an object". Now, I have seen this error a lot and usually I am forgetting to create a new instance or something... but the puzzling thing in this case -- is that I have tested this click event several times...
|
by: MattB |
last post by:
I'm just trying to do some simple javascript in a form to convert Lbs in
one textbox to kg in another. I'm doing the following inside a If Not
IsPostBack block:
Dim strLbs2kg As String
strLbs2kg = "<script language='javascript'> " & _
"function Lbs2kg() " & _
"{" & _
"var Lbs = 0; " & _
"Lbs = " & txtWeight.ClientID & ".value; " & _
|
by: J Huntley Palmer |
last post by:
I am having a horrific time integrating uw-imap's c-client for imap
support in php. The problem is a whole bunch of "Text relocation remains
referenced against symbol" errors during
linking. Any help appreciated!
The ordeal is a follows
I am using Solaris 10 with php5.1.1.
GCC:
| |
by: siewong |
last post by:
Existing Access Database Troubleshooting
I am new to access database and inherited an access application and
all users who were previously able to use this access file
simulataneously are now locked out exclusively . Some have not been
able to get on at all. Obviously, this is the problem, and as far as I
know, no changes have been made to access backend or front end. I have
no historical data as to whether or not the access db was...
|
by: jobs |
last post by:
Re: Troubleshooting Timeout expired. All pooled connections were in
use and max pool size was reached.
New webservers. win2003. IIS6. asp.net 2.0/ sql server 2005 and Oracle
9i through a 64 bit Oracle client. Everything working fine until this.
I started getting these errors as the new website activity started to
heat up.
Timeout expired. The timeout period elapsed prior to obtaining a
|
by: Daniel Peterson |
last post by:
I'm responsible for a pair of IIS 6 webservers that run our production
ASP.Net application. We push code on a monthly basis, and about two weeks
after our October code push, we started to run into occasional webserver
errors.
The application pool is configured to run as a domain user which has
permissions to the web code. When we have issues, the webserver will return
the ASP.Net "Server Application Unavailable" page, and our app pool...
|
by: nsaffary |
last post by:
hi
I hava a client/server program that run correctly when i run it in one computer(local) but when I run client on a one computer and run server run on another, connection does not stablish.(I set server machine IP for client and server) please guide me?
server :
#include <winsock2.h>
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <windows.h>
#pragma comment(lib, "ws2_32");
|
by: omerbutt |
last post by:
hi everyone
can any one guide me if there is any add-on related to troubleshooting javascript errors in IE6
regards,
Omer Aslam
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |