Advertisement

04.21.2008 at 11:35PM PDT, ID: 23341990 | Points: 50
[x]
Attachment Details

Cascading dropdownlist doesn't work properly using jQuery

Asked by raju1 in JScript, PHP Scripting Language

Tags: , ,

Dear Experts,
I am trying to do cascading drop-down-list. When I select division combo, its related district will be populated in district combo. Similarly, when I click district combo, its related than will be populated in thana combo. But it generated following error:

Error: uncaught exception: [Exception... "Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIWebNavigation.loadURI]"  nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)"  location: "JS frame :: chrome://global/content/viewSource.js :: viewSource :: line 141"  data: no]

Regards,
RajuStart Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
<html>
<head>
<title>Departure Card for Bangladeshi</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="new.css" rel="stylesheet" type="text/css">
<?php
require("common.php");
?>
<script language="javascript" src="Jquery.js"></script>
<script language="javascript">
function makeSublist(parent, child, isSubselectOptional, childVal) {
	$("body").append("");
	$('#' + parent + child).html($("#" + child + " option"));
	var parentValue = $('#' + parent).attr('value');
	$('#' + child).html($("#" + parent + child + " .sub_" + parentValue).clone());
	childVal = (typeof childVal == "undefined") ? "" : childVal;
	$("#" + child + ' option[@value="' + childVal + '"]').attr('selected','selected');
	$('#' + parent).change(
	
	
	
	function() {
		var parentValue = $('#' + parent).attr('value');
		$('#' + child).html($("#" + parent + child + " .sub_" + parentValue).clone());
		if (isSubselectOptional) {
			$('#' + child).prepend("  More  ");
		}
		if (document.getElementById(child)) {
			if (document.getElementById(child).options.length == 1) {
				document.getElementById(child).style.visibility = 'hidden';
			} else {
				document.getElementById(child).style.visibility = 'visible';
				$('#' + child).trigger("click");
			}
			} else {
				$('#' + child).trigger("click");
			}
				$('#' + child).trigger("change");
			}
		);
 
}
	$(document).ready(function()
	{
		makeSublist('child','grandsun', true, '');	
		makeSublist('parent','child', false, '1');		
	});
	
function ComboText(ctlComboBox,ctlHidden)
	{
		val=ctlComboBox.value;
		cla=ctlComboBox.className;
		alert(ctlComboBox.className);
		for ( i = 0; i < ctlComboBox.options.length; i++ )
		{
			if (ctlComboBox.options[i].value==val)
			{
			alert(ctlComboBox.options(i).className);
			if (ctlComboBox.options[i].value==val && ctlComboBox.options[i].className==cla)
			{
				ctlHidden.value=ctlComboBox.options[i].text;
				alert(ctlComboBox.options[i].text);
			}
			}
		}
		
	}
</script>
</head>
<form id="cascade" name="cascade" action="cascade3.php" method="post">
<select id="parent" style="width:200px;">
                <?php // id="cascade" name="cascade" action="cascade3.php" method="post" 
			$c = OpenDatabase();
			$rsDistrict = get_DivisionList();
			oci_execute($rsDistrict);
				
			while ($x = oci_fetch_array($rsDistrict)) {
				echo "<OPTION value=".qt.$x['DIVISION_CODE'].qt.">".$x['DIVISION_NAME']."</OPTION>";
			}
			oci_close($c);
		?>
              </select>
 
<select name="child" id="child" style="width:200px;" onChange="ComboText(document.this(),document.child_hidden)">
                <?php
			$c = OpenDatabase();
			$rsVillage = get_DistrictList();
			oci_execute($rsVillage);
 
			while ($x = oci_fetch_array($rsVillage)) {
				echo "<OPTION class=".qt."sub_".$x['DIVISION_CODE'].qt." value=".qt.$x['DISTRICT_CODE'].qt.">".$x['DISTRICT_NAME']."</OPTION>";
			}
			oci_close($c);
		?>
</select>
<input name="child_hidden" type="text" id="child_hidden">
	<select id="grandsun"  style="width:200px;">
                <option value="" selected>Select Thana----</option>
                <?php
			$c = OpenDatabase();
			$rsThana = get_ThanaList();
			oci_execute($rsThana);
 
			while ($x = oci_fetch_array($rsThana)) {
				echo "<OPTION class=".qt."sub_".$x['DISTRICT_CODE'].qt." value=".qt.$x['THANA_CODE'].qt.">".$x['THANA_NAME']."</OPTION>";
			}
			oci_close($c);
		?>
              </select>
 
</form>
 
<body>
</body>
</html>
[+][-]04.22.2008 at 06:31PM PDT, ID: 21417087

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.23.2008 at 01:19PM PDT, ID: 21424922

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.23.2008 at 01:49PM PDT, ID: 21425229

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.23.2008 at 02:26PM PDT, ID: 21425588

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.24.2008 at 08:29AM PDT, ID: 21431953

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.02.2008 at 11:19PM PDT, ID: 21491482

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.03.2008 at 08:22AM PDT, ID: 21492623

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628