<?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: Script.aculo.us Autocompleter Woes</title>
	<atom:link href="http://www.whypad.com/posts/scriptaculous-autocompleter/163/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.whypad.com/posts/scriptaculous-autocompleter/163/</link>
	<description>Tools and Tricks for Life and Tech</description>
	<lastBuildDate>Mon, 23 Jan 2012 14:27:20 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Byron Bennett</title>
		<link>http://www.whypad.com/posts/scriptaculous-autocompleter/163/comment-page-1/#comment-3586</link>
		<dc:creator>Byron Bennett</dc:creator>
		<pubDate>Wed, 09 Dec 2009 04:16:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.whypad.com/?p=163#comment-3586</guid>
		<description>Thanks for the tip!  Prototype and Scriptaculous are stellar choices for javascript libraries.  But, jQuery has gained a lot of traction (even Microsoft adopted jQuery for inclusion with VIsual Studio).  It&#039;s tag line &quot;Write less, do more&quot; is very true.  Worth a look.

Byron</description>
		<content:encoded><![CDATA[<p>Thanks for the tip!  Prototype and Scriptaculous are stellar choices for javascript libraries.  But, jQuery has gained a lot of traction (even Microsoft adopted jQuery for inclusion with VIsual Studio).  It&#8217;s tag line &#8220;Write less, do more&#8221; is very true.  Worth a look.</p>
<p>Byron</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Patrick</title>
		<link>http://www.whypad.com/posts/scriptaculous-autocompleter/163/comment-page-1/#comment-3585</link>
		<dc:creator>Patrick</dc:creator>
		<pubDate>Wed, 09 Dec 2009 03:55:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.whypad.com/?p=163#comment-3585</guid>
		<description>Byron,

Thanks for the reply.  

For others that stumble upon this thread, I just discovered a very simple way to do this.

new Ajax.Autocompleter(&quot;city&quot;,&quot;hint3&quot;,&quot;city.php&quot;,{callback: function(element, entry) { return entry + &quot;&amp;&quot; + Form.Element.serialize(&quot;state&quot;); }});

&quot;state&quot; is the current value in the state form field and it gets passed to the php script.

See: http://www.simpltry.com/2007/01/30/ajaxautocompleter-dynamic-parameters/

Regardless, I may look into jQuery.

Best,
Patrick</description>
		<content:encoded><![CDATA[<p>Byron,</p>
<p>Thanks for the reply.  </p>
<p>For others that stumble upon this thread, I just discovered a very simple way to do this.</p>
<p>new Ajax.Autocompleter(&#8220;city&#8221;,&#8221;hint3&#8243;,&#8221;city.php&#8221;,{callback: function(element, entry) { return entry + &#8220;&amp;&#8221; + Form.Element.serialize(&#8220;state&#8221;); }});</p>
<p>&#8220;state&#8221; is the current value in the state form field and it gets passed to the php script.</p>
<p>See: <a href="http://www.simpltry.com/2007/01/30/ajaxautocompleter-dynamic-parameters/" rel="nofollow">http://www.simpltry.com/2007/01/30/ajaxautocompleter-dynamic-parameters/</a></p>
<p>Regardless, I may look into jQuery.</p>
<p>Best,<br />
Patrick</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Byron Bennett</title>
		<link>http://www.whypad.com/posts/scriptaculous-autocompleter/163/comment-page-1/#comment-3584</link>
		<dc:creator>Byron Bennett</dc:creator>
		<pubDate>Wed, 09 Dec 2009 03:05:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.whypad.com/?p=163#comment-3584</guid>
		<description>Patrick,

Sorry, but I don&#039;t remember if I did or not.  I&#039;ve switched from Prototype and Scriptaculous to jQuery.  I have to say that I LOVE jQuery.  Like everything, there&#039;s a little bit of a learning curve, but the ability to run a function or attach an event to many different elements (like every element containing the class &#039;form-field&#039; makes jQuery worth the move.  I haven&#039;t checked out the autocompleters for jQuery, but I&#039;d bet there are some good ones.

Cheers,
Byron</description>
		<content:encoded><![CDATA[<p>Patrick,</p>
<p>Sorry, but I don&#8217;t remember if I did or not.  I&#8217;ve switched from Prototype and Scriptaculous to jQuery.  I have to say that I LOVE jQuery.  Like everything, there&#8217;s a little bit of a learning curve, but the ability to run a function or attach an event to many different elements (like every element containing the class &#8216;form-field&#8217; makes jQuery worth the move.  I haven&#8217;t checked out the autocompleters for jQuery, but I&#8217;d bet there are some good ones.</p>
<p>Cheers,<br />
Byron</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Patrick</title>
		<link>http://www.whypad.com/posts/scriptaculous-autocompleter/163/comment-page-1/#comment-3583</link>
		<dc:creator>Patrick</dc:creator>
		<pubDate>Wed, 09 Dec 2009 02:22:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.whypad.com/?p=163#comment-3583</guid>
		<description>Byron,

Did you sort out how to setup the call back function to autocomplete on cities when given a state, etc.?  If so, I&#039;d love to see a complete example.  I&#039;m not a java programmer and can&#039;t quite sort out the example posted by  haydeniv.

Thanks,
Patrick</description>
		<content:encoded><![CDATA[<p>Byron,</p>
<p>Did you sort out how to setup the call back function to autocomplete on cities when given a state, etc.?  If so, I&#8217;d love to see a complete example.  I&#8217;m not a java programmer and can&#8217;t quite sort out the example posted by  haydeniv.</p>
<p>Thanks,<br />
Patrick</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: another.designer</title>
		<link>http://www.whypad.com/posts/scriptaculous-autocompleter/163/comment-page-1/#comment-3216</link>
		<dc:creator>another.designer</dc:creator>
		<pubDate>Sat, 26 Sep 2009 22:42:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.whypad.com/?p=163#comment-3216</guid>
		<description>i found this simple example helpful from http://wiki.github.com/madrobby/scriptaculous/ajax-autocompleter

new Ajax.Autocompleter(&quot;autocomplete&quot;, &quot;autocomplete_choices&quot;, &quot;/url/on/server&quot;, {
  afterUpdateElement : getSelectionId
});

function getSelectionId(text, li) {
    alert (li.id);
}</description>
		<content:encoded><![CDATA[<p>i found this simple example helpful from <a href="http://wiki.github.com/madrobby/scriptaculous/ajax-autocompleter" rel="nofollow">http://wiki.github.com/madrobby/scriptaculous/ajax-autocompleter</a></p>
<p>new Ajax.Autocompleter(&#8220;autocomplete&#8221;, &#8220;autocomplete_choices&#8221;, &#8220;/url/on/server&#8221;, {<br />
  afterUpdateElement : getSelectionId<br />
});</p>
<p>function getSelectionId(text, li) {<br />
    alert (li.id);<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Byron Bennett</title>
		<link>http://www.whypad.com/posts/scriptaculous-autocompleter/163/comment-page-1/#comment-529</link>
		<dc:creator>Byron Bennett</dc:creator>
		<pubDate>Thu, 16 Oct 2008 13:27:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.whypad.com/?p=163#comment-529</guid>
		<description>haydeniv,
Thanks for the tip!  That was stumping me bad.

Byron</description>
		<content:encoded><![CDATA[<p>haydeniv,<br />
Thanks for the tip!  That was stumping me bad.</p>
<p>Byron</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: haydeniv</title>
		<link>http://www.whypad.com/posts/scriptaculous-autocompleter/163/comment-page-1/#comment-528</link>
		<dc:creator>haydeniv</dc:creator>
		<pubDate>Thu, 16 Oct 2008 06:51:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.whypad.com/?p=163#comment-528</guid>
		<description>Here&#039;s an example for anyone who is bashing there head in on the callback function:
Function:
&lt;code&gt;
function addItemToList(text, li) {
	var name = document.getElementById(&#039;city&#039;);
	var value = li.id;
	name.value = value;
	document.getElementById(&#039;city_id&#039;).value = li.id;
	document.getElementById(&#039;city&#039;).value = li.innerHTML;
	alert($F(&#039;city_id&#039;));
}
function addItemToState(text, li) {
    // Do other stuff here
}
function callBackFunction() {
	return &quot;name=&quot;+$F(&#039;state&#039;)+&quot;&amp;city_id=&quot;+$F(&#039;city_id&#039;);
}
&lt;/code&gt;
HTML:
&lt;code&gt;
State: 
     City: 
     
      
      
      
new Ajax.Autocompleter(&quot;city&quot;, &quot;name_choices&quot;, &quot;/getCities.php&quot;, {paramName: &quot;name&quot;, minChars: 2, afterUpdateElement: addItemToList, indicator: &#039;indicator1&#039;});
      
new Ajax.Autocompleter(&quot;state&quot;, &quot;name_choices&quot;, &quot;/getStates.php&quot;, {paramName: &quot;name&quot;, minChars: 2, afterUpdateElement: addItemToListState, indicator: &#039;indicator1&#039;, callback: getCityId});
&lt;/code&gt;
Hope that helps.  The key is in the documentation when you use callback it in essense overrides the original paramName so you have to add that value as well in the callback.

Good Luck</description>
		<content:encoded><![CDATA[<p>Here&#8217;s an example for anyone who is bashing there head in on the callback function:<br />
Function:<br />
<code><br />
function addItemToList(text, li) {<br />
	var name = document.getElementById('city');<br />
	var value = li.id;<br />
	name.value = value;<br />
	document.getElementById('city_id').value = li.id;<br />
	document.getElementById('city').value = li.innerHTML;<br />
	alert($F('city_id'));<br />
}<br />
function addItemToState(text, li) {<br />
    // Do other stuff here<br />
}<br />
function callBackFunction() {<br />
	return "name="+$F('state')+"&amp;city_id="+$F('city_id');<br />
}<br />
</code><br />
HTML:<br />
<code><br />
State:<br />
     City: </p>
<p>new Ajax.Autocompleter("city", "name_choices", "/getCities.php", {paramName: "name", minChars: 2, afterUpdateElement: addItemToList, indicator: 'indicator1'});</p>
<p>new Ajax.Autocompleter("state", "name_choices", "/getStates.php", {paramName: "name", minChars: 2, afterUpdateElement: addItemToListState, indicator: 'indicator1', callback: getCityId});<br />
</code><br />
Hope that helps.  The key is in the documentation when you use callback it in essense overrides the original paramName so you have to add that value as well in the callback.</p>
<p>Good Luck</p>
]]></content:encoded>
	</item>
</channel>
</rss>

