<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: jQuery controlled Dependent (or Cascading) Select List</title>
	<atom:link href="http://www.ajaxray.com/blog/2007/07/15/javascript-controlled-dependent-or-cascading-select-list/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ajaxray.com/blog/2007/07/15/javascript-controlled-dependent-or-cascading-select-list/</link>
	<description>Exploring PHP, MySql, Javascript, jQuery, Zend Framework and more... from Bangladesh</description>
	<lastBuildDate>Fri, 21 May 2010 22:36:42 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Majo</title>
		<link>http://www.ajaxray.com/blog/2007/07/15/javascript-controlled-dependent-or-cascading-select-list/comment-page-1/#comment-3720</link>
		<dc:creator>Majo</dc:creator>
		<pubDate>Thu, 21 Jan 2010 15:38:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.ajaxray.com/blog/?p=8#comment-3720</guid>
		<description>Hey Oscar, i have exactly the same problem you have, and i can&#039;t find the solution. Everything seems to be alright, but no....

Have you got the solution?? if so, please tell me about it, i&#039;m desperated...

or... if anyone could help, i&#039;ll appreciate it so much!!!

Thanks for the code!!!
(Sorry for my poor english)</description>
		<content:encoded><![CDATA[<p>Hey Oscar, i have exactly the same problem you have, and i can&#8217;t find the solution. Everything seems to be alright, but no&#8230;.</p>
<p>Have you got the solution?? if so, please tell me about it, i&#8217;m desperated&#8230;</p>
<p>or&#8230; if anyone could help, i&#8217;ll appreciate it so much!!!</p>
<p>Thanks for the code!!!<br />
(Sorry for my poor english)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JR Chew</title>
		<link>http://www.ajaxray.com/blog/2007/07/15/javascript-controlled-dependent-or-cascading-select-list/comment-page-1/#comment-3636</link>
		<dc:creator>JR Chew</dc:creator>
		<pubDate>Tue, 12 Jan 2010 19:33:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.ajaxray.com/blog/?p=8#comment-3636</guid>
		<description>Great post man, saved me!</description>
		<content:encoded><![CDATA[<p>Great post man, saved me!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jovi</title>
		<link>http://www.ajaxray.com/blog/2007/07/15/javascript-controlled-dependent-or-cascading-select-list/comment-page-1/#comment-3612</link>
		<dc:creator>Jovi</dc:creator>
		<pubDate>Wed, 30 Dec 2009 07:28:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.ajaxray.com/blog/?p=8#comment-3612</guid>
		<description>good!</description>
		<content:encoded><![CDATA[<p>good!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Oscar</title>
		<link>http://www.ajaxray.com/blog/2007/07/15/javascript-controlled-dependent-or-cascading-select-list/comment-page-1/#comment-3585</link>
		<dc:creator>Oscar</dc:creator>
		<pubDate>Fri, 18 Dec 2009 16:56:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.ajaxray.com/blog/?p=8#comment-3585</guid>
		<description>Hi, I used your code and worked great, but I have a single problem that is driving me crazy, I have the select values stored in a database, and when I load the form, I need some values to be selected by default, the parent select works fine, but for some reason the child select dosn&#039;t load any values, and when I look at the code the select shows the values it should have, but they just don&#039;t show. Can you help me please with something?? tks a lot.

here is the code I use



&lt;option value=&quot;&quot; &gt;



                            
RubroSubMaqui();
do{
if ($ConsultaRubroSub[1][&#039;id_sub_rubro&#039;] == $sub_rubro){
$select = &quot; selected&quot;;
}else{
$select = &quot;&quot;;  
}
?&gt;
&lt;option class=&quot;sub_&quot; value=&quot;&quot;&gt;



Great Work</description>
		<content:encoded><![CDATA[<p>Hi, I used your code and worked great, but I have a single problem that is driving me crazy, I have the select values stored in a database, and when I load the form, I need some values to be selected by default, the parent select works fine, but for some reason the child select dosn&#8217;t load any values, and when I look at the code the select shows the values it should have, but they just don&#8217;t show. Can you help me please with something?? tks a lot.</p>
<p>here is the code I use</p>
<p>&lt;option value=&quot;&#8221; &gt;</p>
<p>RubroSubMaqui();<br />
do{<br />
if ($ConsultaRubroSub[1]['id_sub_rubro'] == $sub_rubro){<br />
$select = &#8221; selected&#8221;;<br />
}else{<br />
$select = &#8220;&#8221;;<br />
}<br />
?&gt;<br />
&lt;option class=&quot;sub_&#8221; value=&#8221;"&gt;</p>
<p>Great Work</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JunReyes</title>
		<link>http://www.ajaxray.com/blog/2007/07/15/javascript-controlled-dependent-or-cascading-select-list/comment-page-1/#comment-2884</link>
		<dc:creator>JunReyes</dc:creator>
		<pubDate>Fri, 31 Jul 2009 05:34:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.ajaxray.com/blog/?p=8#comment-2884</guid>
		<description>Sorry about the code. I pasted everything but somehow, some of it where lost. 

Anyway the FORM is below the end of HEAD, is that right? In the last 2 select options I applied the class = &quot;sub_&quot;(to what ever code).

And the BODY part is empty?</description>
		<content:encoded><![CDATA[<p>Sorry about the code. I pasted everything but somehow, some of it where lost. </p>
<p>Anyway the FORM is below the end of HEAD, is that right? In the last 2 select options I applied the class = &#8220;sub_&#8221;(to what ever code).</p>
<p>And the BODY part is empty?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Justin</title>
		<link>http://www.ajaxray.com/blog/2007/07/15/javascript-controlled-dependent-or-cascading-select-list/comment-page-1/#comment-2671</link>
		<dc:creator>Justin</dc:creator>
		<pubDate>Tue, 21 Apr 2009 15:28:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.ajaxray.com/blog/?p=8#comment-2671</guid>
		<description>This was really handy. Thanks.</description>
		<content:encoded><![CDATA[<p>This was really handy. Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ø§Ù„Ø¹Ø§Ø¨</title>
		<link>http://www.ajaxray.com/blog/2007/07/15/javascript-controlled-dependent-or-cascading-select-list/comment-page-1/#comment-2637</link>
		<dc:creator>Ø§Ù„Ø¹Ø§Ø¨</dc:creator>
		<pubDate>Thu, 26 Mar 2009 04:18:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.ajaxray.com/blog/?p=8#comment-2637</guid>
		<description>thank you so much man</description>
		<content:encoded><![CDATA[<p>thank you so much man</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jumoke</title>
		<link>http://www.ajaxray.com/blog/2007/07/15/javascript-controlled-dependent-or-cascading-select-list/comment-page-1/#comment-2603</link>
		<dc:creator>Jumoke</dc:creator>
		<pubDate>Sun, 01 Mar 2009 22:00:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.ajaxray.com/blog/?p=8#comment-2603</guid>
		<description>i dont usually comment, but after reading through so much info i had to say thanks</description>
		<content:encoded><![CDATA[<p>i dont usually comment, but after reading through so much info i had to say thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Xiaobai</title>
		<link>http://www.ajaxray.com/blog/2007/07/15/javascript-controlled-dependent-or-cascading-select-list/comment-page-1/#comment-2594</link>
		<dc:creator>Xiaobai</dc:creator>
		<pubDate>Thu, 26 Feb 2009 06:02:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.ajaxray.com/blog/?p=8#comment-2594</guid>
		<description>hi,
i&#039;m tryng this function working with two selects and fill the options with php mysql. On FF it function all right. But in IE 7 don&#039;t execute the (child).hide(). And i find that the pointer of select is correct on the second select, but all the rest of options appears.

do you know why. i&#039;m became krazy.

thanks for your work. Xiaobai.</description>
		<content:encoded><![CDATA[<p>hi,<br />
i&#8217;m tryng this function working with two selects and fill the options with php mysql. On FF it function all right. But in IE 7 don&#8217;t execute the (child).hide(). And i find that the pointer of select is correct on the second select, but all the rest of options appears.</p>
<p>do you know why. i&#8217;m became krazy.</p>
<p>thanks for your work. Xiaobai.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pablo</title>
		<link>http://www.ajaxray.com/blog/2007/07/15/javascript-controlled-dependent-or-cascading-select-list/comment-page-1/#comment-2566</link>
		<dc:creator>Pablo</dc:creator>
		<pubDate>Tue, 10 Feb 2009 21:25:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.ajaxray.com/blog/?p=8#comment-2566</guid>
		<description>Hi Anis,

I ended up altering your old script (since I didnâ€™t know you had updated it and I needed to get it done for a project yesterday), but I was wondering if you could help me tweak it a little bit.  I ended up changing it so that I can call the function â€œonChangeâ€ of the parent select list and also â€œonLoadâ€ of the body/document.  But I canâ€™t figure out how to attach the same function to both â€œonChangeâ€ and â€œonLoadâ€ events.  Could you take a look at the code below and point me in the right direction?  Any help is greatly appreciated!

function RelateDD(parent,child,isSubselectOptional,str,val) {
	$j(&quot;body&quot;).append(&quot;&quot;);
	$j(&#039;#&#039;+parent+child).html($j(&quot;#&quot;+child+&quot; option&quot;));
	$j(&#039;#&#039;+child).html(&quot;&quot;+str+&quot;&quot;);
	$j(&#039;#&#039;+parent).change(
		function() {
			var parentValue = $j(&#039;#&#039;+parent).attr(&#039;value&#039;);
			$j(&#039;#&#039;+child).html($j(&quot;#&quot;+parent+child+&quot; .sub_&quot;+parentValue).clone());
			if($j(&#039;#&#039;+child).html().indexOf(&quot;selected&quot;) &gt; -1 &amp;&amp; val != &quot;&quot;) {
				$j(&quot;#&quot;+child+&#039; option[value=&quot;&#039;+val+&#039;&quot;]&#039;).attr(&#039;selected&#039;,&#039;selected&#039;);
			}
			if(isSubselectOptional) {
				$j(&#039;#&#039;+child).prepend(&quot;&quot;+str+&quot;&quot;);
				if(val == &quot;&quot;) $j(&quot;#&quot;+child+&#039; option[text=&quot;&#039;+str+&#039;&quot;]&#039;).attr(&#039;selected&#039;,&#039;selected&#039;);
			}
			$j(&#039;#&#039;+child).focus();
		}
	);
	$j(window).load(
		function() {
			var parentValue = $j(&#039;#&#039;+parent).attr(&#039;value&#039;);
			$j(&#039;#&#039;+child).html($j(&quot;#&quot;+parent+child+&quot; .sub_&quot;+parentValue).clone());
			if($j(&#039;#&#039;+child).html().indexOf(&quot;selected&quot;) &gt; -1 &amp;&amp; val != &quot;&quot;) {
				$j(&quot;#&quot;+child+&#039; option[value=&quot;&#039;+val+&#039;&quot;]&#039;).attr(&#039;selected&#039;,&#039;selected&#039;);
			}
			if(isSubselectOptional) {
				$j(&#039;#&#039;+child).prepend(&quot;&quot;+str+&quot;&quot;);
				if(val == &quot;&quot;) $j(&quot;#&quot;+child+&#039; option[text=&quot;&#039;+str+&#039;&quot;]&#039;).attr(&#039;selected&#039;,&#039;selected&#039;);
			}
		}
	);
}
$j(document).ready(function() {
	RelateDD(&#039;ls&#039;,&#039;lc&#039;,true,&#039;All&#039;,&#039;1&#039;);
});

Thank you!</description>
		<content:encoded><![CDATA[<p>Hi Anis,</p>
<p>I ended up altering your old script (since I didnâ€™t know you had updated it and I needed to get it done for a project yesterday), but I was wondering if you could help me tweak it a little bit.  I ended up changing it so that I can call the function â€œonChangeâ€ of the parent select list and also â€œonLoadâ€ of the body/document.  But I canâ€™t figure out how to attach the same function to both â€œonChangeâ€ and â€œonLoadâ€ events.  Could you take a look at the code below and point me in the right direction?  Any help is greatly appreciated!</p>
<p>function RelateDD(parent,child,isSubselectOptional,str,val) {<br />
	$j(&#8221;body&#8221;).append(&#8221;");<br />
	$j(&#8217;#'+parent+child).html($j(&#8221;#&#8221;+child+&#8221; option&#8221;));<br />
	$j(&#8217;#'+child).html(&#8221;"+str+&#8221;");<br />
	$j(&#8217;#'+parent).change(<br />
		function() {<br />
			var parentValue = $j(&#8217;#'+parent).attr(&#8217;value&#8217;);<br />
			$j(&#8217;#'+child).html($j(&#8221;#&#8221;+parent+child+&#8221; .sub_&#8221;+parentValue).clone());<br />
			if($j(&#8217;#'+child).html().indexOf(&#8221;selected&#8221;) &gt; -1 &amp;&amp; val != &#8220;&#8221;) {<br />
				$j(&#8221;#&#8221;+child+&#8217; option[value="'+val+'"]&#8216;).attr(&#8217;selected&#8217;,&#8217;selected&#8217;);<br />
			}<br />
			if(isSubselectOptional) {<br />
				$j(&#8217;#'+child).prepend(&#8221;"+str+&#8221;");<br />
				if(val == &#8220;&#8221;) $j(&#8221;#&#8221;+child+&#8217; option&#8217;).attr(&#8217;selected&#8217;,&#8217;selected&#8217;);<br />
			}<br />
			$j(&#8217;#'+child).focus();<br />
		}<br />
	);<br />
	$j(window).load(<br />
		function() {<br />
			var parentValue = $j(&#8217;#'+parent).attr(&#8217;value&#8217;);<br />
			$j(&#8217;#'+child).html($j(&#8221;#&#8221;+parent+child+&#8221; .sub_&#8221;+parentValue).clone());<br />
			if($j(&#8217;#'+child).html().indexOf(&#8221;selected&#8221;) &gt; -1 &amp;&amp; val != &#8220;&#8221;) {<br />
				$j(&#8221;#&#8221;+child+&#8217; option[value="'+val+'"]&#8216;).attr(&#8217;selected&#8217;,&#8217;selected&#8217;);<br />
			}<br />
			if(isSubselectOptional) {<br />
				$j(&#8217;#'+child).prepend(&#8221;"+str+&#8221;");<br />
				if(val == &#8220;&#8221;) $j(&#8221;#&#8221;+child+&#8217; option&#8217;).attr(&#8217;selected&#8217;,&#8217;selected&#8217;);<br />
			}<br />
		}<br />
	);<br />
}<br />
$j(document).ready(function() {<br />
	RelateDD(&#8217;ls&#8217;,'lc&#8217;,true,&#8217;All&#8217;,'1&#8242;);<br />
});</p>
<p>Thank you!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
