<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Rise of the PHX</title>
	<atom:link href="http://riseofthephx.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://riseofthephx.com</link>
	<description>Web musings in the Valley of the Sun.</description>
	<lastBuildDate>Wed, 01 Jun 2011 15:21:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>Ancient greeks on Memorial Day</title>
		<link>http://riseofthephx.com/2011/06/01/ancient-greeks-on-memorial-day/</link>
		<comments>http://riseofthephx.com/2011/06/01/ancient-greeks-on-memorial-day/#comments</comments>
		<pubDate>Wed, 01 Jun 2011 15:02:21 +0000</pubDate>
		<dc:creator>Gregg</dc:creator>
				<category><![CDATA[Imagine if this stuff was lost in the dirt]]></category>
		<category><![CDATA[Inspiration]]></category>

		<guid isPermaLink="false">http://riseofthephx.com/?p=173</guid>
		<description><![CDATA[Like many Americans it is often non until the flags of memorial day catch breeze that my thoughts turn to those who have risked and given all so that I can enjoy my many freedoms and rest easy in the thought that my children will live and die under the same flag and in similar [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://riseofthephx.com/wp-content/uploads/2011/06/Oration.jpg"><img src="http://riseofthephx.com/wp-content/uploads/2011/06/Oration.jpg" alt="" title="Oration" width="659" height="291" class="aligncenter size-full wp-image-174" /></a>Like many Americans it is often non until the flags of memorial day catch breeze that my thoughts turn to those who have risked and given all so that I can enjoy my many freedoms and rest easy in the thought that my children will live and die under the same flag and in similar freedom.  I know I am 3 days late in posting but the words which I dust off, though roughly 2400 years old, stirred me to a post.  The stirring words were those of Pericles in his funeral oration, as penned by <a href="http://en.wikipedia.org/wiki/Thucydides">Thucydides</a> in his <a href="http://en.wikipedia.org/wiki/History_of_the_Peloponnesian_War">The History of the Peloponnesian War</a>.  It is striking that though spoken over the dead of the Athenians, Pericles&#8217;s oration so timelessly captures the emotion and thought of any age where we sacrifice a generation to ensure the existence of those to come.  So if you have a quiet moment then surrender some time to reading or listening to the words of Pericles as he exalts those that have fallen.</p>
<p>&#8220;&#8230;you must reflect that it was by courage, sense of duty, and a keen feeling of honor in action that men were enabled to win all this, and that no personal failure in an enterprise could make them consent to deprive their country of their valor, but they laid it at her feet as the most glorious contribution that they could offer.&#8221;</p>
<p>Funeral Oration of Pericles<br />
read it: (<a href="http://www.mtholyoke.edu/acad/intrel/pericles.htm">http://www.mtholyoke.edu/acad/intrel/pericles.htm</a>)<br />
hear it: (<a href="http://ia600306.us.archive.org/28/items/nonfiction002_librivox/funeralorationpericles_thucydides_mlc.mp3">http://ia600306.us.archive.org/28/items/nonfiction002_librivox/funeralorationpericles_thucydides_mlc.mp3</a>)<br />
read about it on wikipedia: (<a href="http://en.wikipedia.org/wiki/Pericles'_Funeral_Oration">http://en.wikipedia.org/wiki/Pericles&#8217;_Funeral_Oration</a>)</p>
]]></content:encoded>
			<wfw:commentRss>http://riseofthephx.com/2011/06/01/ancient-greeks-on-memorial-day/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://ia600306.us.archive.org/28/items/nonfiction002_librivox/funeralorationpericles_thucydides_mlc.mp3" length="19746622" type="audio/mpeg" />
		</item>
		<item>
		<title>Technology vs. Creativity</title>
		<link>http://riseofthephx.com/2010/10/14/technology-vs-creativity/</link>
		<comments>http://riseofthephx.com/2010/10/14/technology-vs-creativity/#comments</comments>
		<pubDate>Thu, 14 Oct 2010 12:17:19 +0000</pubDate>
		<dc:creator>Gregg</dc:creator>
				<category><![CDATA[Random Thought]]></category>
		<category><![CDATA[rambling]]></category>
		<category><![CDATA[rant]]></category>

		<guid isPermaLink="false">http://riseofthephx.com/2010/10/15/technology-vs-creativity/</guid>
		<description><![CDATA[I perceive technology and creativity as very reciprocal. Both pushing the other further and broader through our(humans as a whole) spacial and temporal existence. i.e.. Technology empowers and inspires the creative, not always with what is there but often by what is lacking. The creative pushes technology to it&#8217;s brink where it either dies a [...]]]></description>
			<content:encoded><![CDATA[<p>I perceive technology and creativity as very reciprocal.  Both pushing the other further and broader through our(humans as a whole) spacial and temporal existence.  i.e.. Technology empowers and inspires the creative, not always with what is there but often by what is lacking.  The creative pushes technology to it&#8217;s brink where it either dies a complacent death or evolves to inspire and empower our children.</p>
]]></content:encoded>
			<wfw:commentRss>http://riseofthephx.com/2010/10/14/technology-vs-creativity/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Adding Vimeo/Youtube iframe embed to CKeditor</title>
		<link>http://riseofthephx.com/2010/10/13/adding-vimeoyoutube-iframe-embed-to-ckeditor/</link>
		<comments>http://riseofthephx.com/2010/10/13/adding-vimeoyoutube-iframe-embed-to-ckeditor/#comments</comments>
		<pubDate>Wed, 13 Oct 2010 17:21:37 +0000</pubDate>
		<dc:creator>Gregg</dc:creator>
				<category><![CDATA[boring code]]></category>
		<category><![CDATA[Design]]></category>

		<guid isPermaLink="false">http://riseofthephx.com/?p=153</guid>
		<description><![CDATA[I am in the middle of building a few apps that rely on a text editor and after much research I decided on using CKEditor, a beautiful, well supported WYSIWYG. Within our organization we use video hosted on Vimeo to stream our media as it is both an awesome and cost effective service. The rub [...]]]></description>
			<content:encoded><![CDATA[<p>I am in the middle of building a few apps that rely on a text editor and after much research I decided on using <a href="http://ckeditor.com/">CKEditor</a>, a beautiful, well supported WYSIWYG.</p>
<p>Within our organization we use video hosted on <a href="http://vimeo.com">Vimeo</a> to stream our media as it is both an awesome and cost effective service.</p>
<p>The rub is that the users of my apps would much rather have an easy way to embed their videos rather than embed using the available CKEditor embed function, as embed code can pretty scary to end users and using the new iframe embed method made video from Vimeo and Youtube available on iphone/ipad/etc.</p>
<p>So I reengineered the embed plugin to let an end user embed a Vimeo video to their content by only providing the Vimeo video&#8217;s id.  By adding the <strong>vimeo plugin</strong> to the CKEditor config, and including <strong>Vimeo</strong> in your toolbar definition you now have a shiny vimeo button:<br />
<img class="aligncenter size-full wp-image-154" title="Screen shot 2010-10-13 at 10.05.56 AM" src="http://riseofthephx.com/wp-content/uploads/2010/10/Screen-shot-2010-10-13-at-10.05.56-AM.png" alt="" width="180" height="33" /></p>
<p>By clicking on the Vimeo icon the user receives the following dialog box:<br />
<img class="aligncenter size-full wp-image-155" title="Screen shot 2010-10-13 at 10.06.20 AM" src="http://riseofthephx.com/wp-content/uploads/2010/10/Screen-shot-2010-10-13-at-10.06.20-AM.png" alt="" width="650" height="415" /></p>
<p>After entering the id and OK the video is embedded in the content.  Power users can then modify widths, and other settings.</p>
<p>Oh and as you may have noticed above I have done the same for &#8216;Youtube&#8217; as well.<br />
Just call on plugin youtube and use Youtube to get the shiny Youtube button and embed function.<br />
<img src="http://riseofthephx.com/wp-content/uploads/2010/10/Screen-shot-2010-10-13-at-10.06.32-AM.png" alt="" title="Screen shot 2010-10-13 at 10.06.32 AM" width="611" height="372" class="aligncenter size-full wp-image-156" /></p>
<p>They are a bit rough but at the moment they get the job done.  Feed back is very much appreciated.<br />
<a href='http://riseofthephx.com/wp-content/uploads/2010/10/vimeo.zip'>vimeo plugin (zip)</a> | <a href='http://riseofthephx.com/wp-content/uploads/2010/10/youtube.zip'>youtube plugin (zip)</a></p>
<p><strong>Update:</strong><br />
You may have to first click on the editor window for the embed to work.  as it needs to know where you want to place the video.  I will look into adding a focus so this is not necessary.</p>
<p>As a side note if you are using the plugin on an https domain you may want to update the vimeo URL to &#8220;https://secure/vimeo.com/&#8230;&#8221; and YouTube to &#8220;https://youtube.com/&#8230;&#8221; to avoid scary errors in IE and missing content in the editor.</p>
]]></content:encoded>
			<wfw:commentRss>http://riseofthephx.com/2010/10/13/adding-vimeoyoutube-iframe-embed-to-ckeditor/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Science and Religion</title>
		<link>http://riseofthephx.com/2010/07/19/science-and-religion/</link>
		<comments>http://riseofthephx.com/2010/07/19/science-and-religion/#comments</comments>
		<pubDate>Mon, 19 Jul 2010 18:29:49 +0000</pubDate>
		<dc:creator>gturnbul</dc:creator>
				<category><![CDATA[Entertaining Me is Easy]]></category>

		<guid isPermaLink="false">http://riseofthephx.com/2010/07/19/science-and-religion/</guid>
		<description><![CDATA[I do appreciate this quote: &#8220;Bad science and bad religion simply swap roles, the former proclaiming Truth, the latter worshiping Doubt” Jeffrey Satinover It just seems that nearly half of the world cling to axioms of the past and almost all the rest snicker at the latter, celebrating nothingness. A slim group that falls in [...]]]></description>
			<content:encoded><![CDATA[<p>I do appreciate this quote:<br />
&#8220;Bad science and bad religion simply swap roles, the former proclaiming Truth, the latter worshiping Doubt”<br />
 Jeffrey Satinover</p>
<p>It just seems that nearly half of the world cling to axioms of the past and almost all the rest snicker at the latter, celebrating nothingness.  A slim group that falls in between the two are equally in love with science and in awe of this universe that with Socratic insight will not make assumptions either way.  Learn to embrace the idea that you could be wrong and your world opens up.   </p>
]]></content:encoded>
			<wfw:commentRss>http://riseofthephx.com/2010/07/19/science-and-religion/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>James Earl Jones reading the Raven FTW</title>
		<link>http://riseofthephx.com/2010/05/22/james-earl-jones-reading-the-raven-ftw/</link>
		<comments>http://riseofthephx.com/2010/05/22/james-earl-jones-reading-the-raven-ftw/#comments</comments>
		<pubDate>Sun, 23 May 2010 04:05:23 +0000</pubDate>
		<dc:creator>Gregg</dc:creator>
				<category><![CDATA[Entertaining Me is Easy]]></category>

		<guid isPermaLink="false">http://riseofthephx.com/?p=149</guid>
		<description><![CDATA[So the kids love bed time stories and I still pull out the Seuss, Hippos, Sendak, etc, but now the older 2 kiddos are craving a bit more notoriety in their slumber story. They have become fans of Aesop and the Grimms. I have also been mixing in some poems and a while back we ran across [...]]]></description>
			<content:encoded><![CDATA[<p>So the kids love bed time stories and I still pull out the Seuss, Hippos, Sendak, etc, but now the older 2 kiddos are craving a bit more notoriety in their slumber story.  They have become fans of Aesop and the Grimms.  I have also been mixing in some poems and a while back we ran across the Raven by Edgar Allen Poe. I made them whisper Nevermore on queue and it was a hit.  Just came across this rendition.  <del datetime="2010-05-23T03:58:50+00:00">Darth Vadar</del> James Earl Jones owning the Raven. note, DRAT!! cuts off right before the last Nevermore.</p>
<p><object width="660" height="525"><param name="movie" value="http://www.youtube.com/v/sXU3RfB7308&#038;hl=en_US&#038;fs=1&#038;rel=0&#038;border=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/sXU3RfB7308&#038;hl=en_US&#038;fs=1&#038;rel=0&#038;border=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="660" height="525"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://riseofthephx.com/2010/05/22/james-earl-jones-reading-the-raven-ftw/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>&#8216;Humpback&#8217; is the Weekend at Bernie&#8217;s of the One Thousand and One Nights</title>
		<link>http://riseofthephx.com/2010/05/20/humpback-is-the-weekend-at-bernies-is-the-one-thousand-and-one-nights/</link>
		<comments>http://riseofthephx.com/2010/05/20/humpback-is-the-weekend-at-bernies-is-the-one-thousand-and-one-nights/#comments</comments>
		<pubDate>Fri, 21 May 2010 04:39:10 +0000</pubDate>
		<dc:creator>Gregg</dc:creator>
				<category><![CDATA[Entertaining Me is Easy]]></category>

		<guid isPermaLink="false">http://riseofthephx.com/?p=144</guid>
		<description><![CDATA[Just read the Humpback, a short story in &#8216;The thousand and one nights: or, The Arabian night&#8217;s entertainments, Volume 1&#8242; to my kiddos as a bed time story. The crazy stuff I read to my kids, I know&#8230; Weekend at Bernie&#8217;s of the Arabian world.  Also trying out embedding Google books in a post.]]></description>
			<content:encoded><![CDATA[<p>Just read the <strong>Humpback</strong>, a short story in <em>&#8216;The thousand and one nights: or, The Arabian night&#8217;s entertainments, Volume 1&#8242;</em> to my kiddos as a bed time story. The crazy stuff I read to my kids, I know&#8230; Weekend at Bernie&#8217;s of the Arabian world.  Also trying out embedding Google books in a post.</p>
<p><a href="http://books.google.com/books?id=yCIYAAAAYAAJ&amp;lpg=PA156&amp;ots=Hvbv8cfbU6&amp;dq=humpback%20thousand%20and%20one%20nights&amp;pg=PA156&amp;ci=26%2C52%2C946%2C1432&amp;source=bookclip"><img src="http://books.google.com/books?id=yCIYAAAAYAAJ&amp;pg=PA156&amp;img=1&amp;zoom=3&amp;hl=en&amp;sig=ACfU3U21MkBRT_n_SuBxMSFSzXBM-ClI1Q&amp;ci=26%2C52%2C946%2C1432&amp;edge=0" alt="" /></a></p>
<p><a href="http://books.google.com/books?id=yCIYAAAAYAAJ&amp;lpg=PA156&amp;ots=Hvbv8cfbU6&amp;dq=humpback%20thousand%20and%20one%20nights&amp;pg=PA157&amp;ci=50%2C132%2C861%2C1399&amp;source=bookclip"><img src="http://books.google.com/books?id=yCIYAAAAYAAJ&amp;pg=PA157&amp;img=1&amp;zoom=3&amp;hl=en&amp;sig=ACfU3U0m8x4dsOtwNtX8_SItl1r_-3k2mg&amp;ci=50%2C132%2C861%2C1399&amp;edge=0" alt="" /></a></p>
<p><a href="http://books.google.com/books?id=yCIYAAAAYAAJ&amp;lpg=PA156&amp;ots=Hvbv8cfbU6&amp;dq=humpback%20thousand%20and%20one%20nights&amp;pg=PA158&amp;ci=89%2C131%2C858%2C1346&amp;source=bookclip"><img src="http://books.google.com/books?id=yCIYAAAAYAAJ&amp;pg=PA158&amp;img=1&amp;zoom=3&amp;hl=en&amp;sig=ACfU3U1f5UrLm8aDLEuoJ0v2Se-N_xm6Sg&amp;ci=89%2C131%2C858%2C1346&amp;edge=0" alt="" /></a></p>
<p><a href="http://books.google.com/books?id=yCIYAAAAYAAJ&amp;lpg=PA156&amp;ots=Hvbv8cfbU6&amp;dq=humpback%20thousand%20and%20one%20nights&amp;pg=PA159&amp;ci=70%2C97%2C847%2C1355&amp;source=bookclip"><img src="http://books.google.com/books?id=yCIYAAAAYAAJ&amp;pg=PA159&amp;img=1&amp;zoom=3&amp;hl=en&amp;sig=ACfU3U2f3YeDMkW-dx5yauVivSwuGUr9bQ&amp;ci=70%2C97%2C847%2C1355&amp;edge=0" alt="" /></a></p>
<p><a href="http://books.google.com/books?id=yCIYAAAAYAAJ&amp;lpg=PA156&amp;ots=Hvbv8cfbU6&amp;dq=humpback%20thousand%20and%20one%20nights&amp;pg=PA160&amp;ci=85%2C129%2C891%2C496&amp;source=bookclip"><img src="http://books.google.com/books?id=yCIYAAAAYAAJ&amp;pg=PA160&amp;img=1&amp;zoom=3&amp;hl=en&amp;sig=ACfU3U2KQER19S31Mgt9qG4BVeLRplBZdQ&amp;ci=85%2C129%2C891%2C496&amp;edge=0" alt="" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://riseofthephx.com/2010/05/20/humpback-is-the-weekend-at-bernies-is-the-one-thousand-and-one-nights/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Post Mother&#8217;s day Twitter banter</title>
		<link>http://riseofthephx.com/2010/05/10/post-mothers-day-twitter-banter/</link>
		<comments>http://riseofthephx.com/2010/05/10/post-mothers-day-twitter-banter/#comments</comments>
		<pubDate>Mon, 10 May 2010 21:36:00 +0000</pubDate>
		<dc:creator>Gregg</dc:creator>
				<category><![CDATA[Random Thought]]></category>

		<guid isPermaLink="false">http://riseofthephx.com/?p=141</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p><img src="http://riseofthephx.com/wp-content/uploads/2010/05/tweet_froms_mothers_day.jpg" alt="" title="tweet_froms_mothers_day" width="475" height="234" class="aligncenter size-full wp-image-142" /></p>
]]></content:encoded>
			<wfw:commentRss>http://riseofthephx.com/2010/05/10/post-mothers-day-twitter-banter/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Text Replacement&#8230; Without Flash</title>
		<link>http://riseofthephx.com/2010/05/07/text-replacement-without-flash/</link>
		<comments>http://riseofthephx.com/2010/05/07/text-replacement-without-flash/#comments</comments>
		<pubDate>Fri, 07 May 2010 18:33:12 +0000</pubDate>
		<dc:creator>Gregg</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[Fonts]]></category>

		<guid isPermaLink="false">http://riseofthephx.com/2010/05/07/text-replacement-without-flash/</guid>
		<description><![CDATA[I always dreaded creating image headers for websites, but always saw the headers as the perfect place to add style and tie the content to the design. Then along came SiFR(www.mikeindustries.com/blog/sifr). I could now embed font in flash and use java script to call upon all the font, and css to provide additional style. Life [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://typeface.neocracy.org/"><img src="http://riseofthephx.com/wp-content/uploads/2010/05/Screen-shot-2010-05-07-at-11.34.49-AM-300x67.png" alt="typefacelogo" title="typfacelogo" width="300" height="67" class="aligncenter size-medium wp-image-136" /></a></p>
<p>I always dreaded creating image headers for websites, but always saw the headers as the perfect place to add style and tie the content to the design.  Then along came SiFR(<a href="www.mikeindustries.com/blog/sifr">www.mikeindustries.com/blog/sifr</a>).  I could now embed font in flash and use java script to call upon all the font, and css to provide additional style.  Life was very good, besides the sporadic issues with the font not showing up in certain Microsoft browsers, have you heard of them.</p>
<p>But today I again revisited text-replacement and found typeface.js.  It is just awesome and strictly a javascript based tool.  I just used it for the first time on<a href=" http://burningtreecellars.com"> http://burningtreecellars.com</a>, and it ease of implementation is astounding.  If you are on the hunt for a standard based tool for text replacement, I can do nothing but highly recommend it.</p>
<p>Take it for a spin: Typeface.js (<a href="http://typeface.neocracy.org/">http://typeface.neocracy.org/</a>)</p>
<p><em>Disclaimer: I have yet to run it through the gauntlet of browsers to verify cross browser compatibility but will keep you posted if weirdness rears its ugly head</em></p>
]]></content:encoded>
			<wfw:commentRss>http://riseofthephx.com/2010/05/07/text-replacement-without-flash/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Find pesky duplicates in mysql</title>
		<link>http://riseofthephx.com/2009/12/14/find-pesky-duplicates-in-mysql/</link>
		<comments>http://riseofthephx.com/2009/12/14/find-pesky-duplicates-in-mysql/#comments</comments>
		<pubDate>Mon, 14 Dec 2009 17:00:23 +0000</pubDate>
		<dc:creator>gturnbul</dc:creator>
				<category><![CDATA[boring code]]></category>

		<guid isPermaLink="false">http://riseofthephx.com/?p=129</guid>
		<description><![CDATA[Let&#8217;s say you had an app that had a ton of users and were suspicious that there were pesky duplicates. Here is a quick mysql select to help put your mind at ease. select username,count(*) as n from users group by username having n > 1; or search by first and last name: select concat(firstname,' [...]]]></description>
			<content:encoded><![CDATA[<p>Let&#8217;s say you had an app that had a ton of users and were suspicious that there were pesky duplicates.  Here is a quick mysql select to help put your mind at ease.</p>
<p><code><br />
select username,count(*) as n<br />
 from users<br />
group by username<br />
having  n > 1;<br />
</code></p>
<p>or search by first and last name:</p>
<p><code><br />
select concat(firstname,' ',lastname) as name, count(*) as n<br />
 from users<br />
group by name<br />
having  n > 1;<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://riseofthephx.com/2009/12/14/find-pesky-duplicates-in-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting observe_field to update a text_field in Rails</title>
		<link>http://riseofthephx.com/2009/11/13/getting-observe_field-to-update-a-text_field-in-rails/</link>
		<comments>http://riseofthephx.com/2009/11/13/getting-observe_field-to-update-a-text_field-in-rails/#comments</comments>
		<pubDate>Fri, 13 Nov 2009 23:24:44 +0000</pubDate>
		<dc:creator>Gregg</dc:creator>
				<category><![CDATA[Adventures on the Rails]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[observe_field]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[text_field]]></category>

		<guid isPermaLink="false">http://riseofthephx.com/?p=118</guid>
		<description><![CDATA[I am writing this post as I scoured page after page with out luck and came up with this solution.  Others may already be all over this method or have more eloquent solutions but there people didn&#8217;t have their content search engine optimized.  So for those in need here ya go. I have used observe_field [...]]]></description>
			<content:encoded><![CDATA[<p><img style="float:left;padding:11px;" title="Square Peg in a Round Hole_0565" src="http://riseofthephx.com/wp-content/uploads/2009/11/square-peg-round-hole.jpg" alt="Square Peg in a Round Hole_0565" width="290" height="414" /></p>
<p>I am writing this post as I scoured page after page with out luck and came up with this solution.  Others may already be all over this method or have more eloquent solutions but there people didn&#8217;t have their content search engine optimized.  So for those in need here ya go.</p>
<p>I have used observe_field on occasion in great success to update select form elements in form_for and form_tags but ran into trouble an when trying to have one text_fields value influence the value of another text_fields.</p>
<h3>The Goal</h3>
<p>I wanted to auto populate the city in a text_field  based on the zip code information provided  in the text_field above.  With the city and zip code I am planning  to build a layered Google maps component ( but that is for a later post).  For now if the city could pre-populate based on zipcode provided, and allow for corrections if the user wanted to put in a different city, then I win&#8230;.  streamers and confetti fall from the ceiling.</p>
<h3>What Didn&#8217;t Work</h3>
<blockquote><p>&lt;p&gt;<br />
&lt;%= f.label :zipcode, &#8220;Zip code&#8221; %&gt;: &lt;%= f.text_field :zipcode, :size=&gt;&#8217;8&#8242; %&gt;<br />
&lt;/p&gt;</p>
<p id="city_lookup">&lt;p&gt;<br />
&lt;%= f.label :city, &#8220;City (change if zip code lookup is incorrect): &#8221; -%&gt;&lt;%= f.text_field :city -%&gt;<br />
&lt;/p&gt;</p>
<p>&lt;%= observe_field &#8216;community_zipcode&#8217;,:method =&gt; :get,:frequency =&gt; 0.25,:update =&gt; &#8216;community_city&#8217;,:url =&gt; {:controller=&gt;&#8217;communities&#8217;,:action =&gt; &#8216;getcity&#8217;},:with =&gt; &#8220;zipcode&#8221; -%&gt;</p></blockquote>
<p>Notice above that I tried to reference the DOM id of the text_field I was interested in updating directly.  It did not work as I wished so I moved on to plan B.</p>
<h3>Plan B</h3>
<p>Plan B involved creating a partial &#8216;_city_lookup.html.erb&#8217; with contents:</p>
<blockquote><p>&lt;label for=&#8221;community_city&#8221;&gt;City (change if zip code lookup is incorrect):&lt;/label&gt;&lt;input id=&#8221;community_city&#8221; name=&#8221;community[city]&#8221; size=&#8221;30&#8243; type=&#8221;text&#8221; value=&#8221;&lt;%=@city%&gt;&#8221; /&gt;</p></blockquote>
<p>The method or action, in communities_controller.rb is  now set as follows:</p>
<blockquote><p>def getcity<br />
unless request.xhr?<br />
flash[:error] = &#8216;Invalid page&#8217;<br />
redirect_to &#8220;/&#8221;<br />
else<br />
location = ZipCode.find(:first,:conditions=&gt;['zip=?',params[:zipcode].to_i]) rescue nil<br />
@city= location.blank? ? &#8216;no zipcode match&#8217; : location.city<br />
render :partial=&gt;&#8217;city_lookup&#8217;, :layout =&gt; false, :locals =&gt; {:city =&gt; @city}<br />
end<br />
end</p></blockquote>
<p>The new view code, notice the &#8216;id&#8217; of &#8216;city_lookup&#8217; now on the paragraph holding the text_field we are interested in updating.  Our partial now will replace the contents of this paragraph when a change is made in the zip code field.</p>
<blockquote><p>&lt;p&gt;<br />
&lt;%= f.label :zipcode, &#8220;Zip code&#8221; %&gt;: &lt;%= f.text_field :zipcode, :size=&gt;&#8217;8&#8242; %&gt;<br />
&lt;/p&gt;<br />
&lt;p id=&#8221;city_lookup&#8221;&gt;<br />
&lt;%= f.label :city, &#8220;City (change if zip code lookup is incorrect): &#8221; -%&gt;&lt;%= f.text_field :city -%&gt;<br />
&lt;/p&gt;<br />
&lt;%= observe_field &#8216;community_zipcode&#8217;,:method =&gt; :get,:frequency =&gt; 0.25,:update =&gt; &#8216;city_lookup&#8217;,:url =&gt; {:controller=&gt;&#8217;communities&#8217;,:action =&gt; &#8216;getcity&#8217;},:with =&gt; &#8220;zipcode&#8221; -%&gt;</p></blockquote>
<p>That&#8217;s all folks.  I will update once site is online for working examples.</p>
]]></content:encoded>
			<wfw:commentRss>http://riseofthephx.com/2009/11/13/getting-observe_field-to-update-a-text_field-in-rails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

