<?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"
	>
<channel>
	<title>Comments on: enter the world of AJAX - solving problems with saving records</title>
	<atom:link href="http://www.selfadhesivelabels.com/blog/2007/03/16/enter-the-world-of-ajax-solving-problems-with-saving-records/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.selfadhesivelabels.com/blog/2007/03/16/enter-the-world-of-ajax-solving-problems-with-saving-records/</link>
	<description>Describing our migration to open source software and UK business issues in label printing.</description>
	<pubDate>Wed, 20 Aug 2008 21:37:53 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: Michael</title>
		<link>http://www.selfadhesivelabels.com/blog/2007/03/16/enter-the-world-of-ajax-solving-problems-with-saving-records/#comment-30</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Mon, 19 Mar 2007 01:09:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.selfadhesivelabels.com/blog/2007/03/16/enter-the-world-of-ajax-solving-problems-with-saving-records/#comment-30</guid>
		<description>Hm, I wasn't expecting your blog software to allow HTML, so my example code isn't displayed correctly. 

Let's try again:

&#60;%= link_to_remote("[Edit]", :update =&#62; "address_div", :url =&#62; { :controller=&#62;'common/address', :action =&#62; :address_editor, :id=&#62;address.id }) %&#62;

That one line of code produces, as output, an HTML anchor tag with a javascript event that performs an AJAX call back to the server, retrieves an HTML fragment, and uses it to replace the innerHTML of a div with the id "address_div".</description>
		<content:encoded><![CDATA[<p>Hm, I wasn&#8217;t expecting your blog software to allow HTML, so my example code isn&#8217;t displayed correctly. </p>
<p>Let&#8217;s try again:</p>
<p>&lt;%= link_to_remote(&#8221;[Edit]&#8220;, :update =&gt; &#8220;address_div&#8221;, :url =&gt; { :controller=&gt;&#8217;common/address&#8217;, :action =&gt; :address_editor, :id=&gt;address.id }) %&gt;</p>
<p>That one line of code produces, as output, an HTML anchor tag with a javascript event that performs an AJAX call back to the server, retrieves an HTML fragment, and uses it to replace the innerHTML of a div with the id &#8220;address_div&#8221;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael</title>
		<link>http://www.selfadhesivelabels.com/blog/2007/03/16/enter-the-world-of-ajax-solving-problems-with-saving-records/#comment-29</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Mon, 19 Mar 2007 01:03:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.selfadhesivelabels.com/blog/2007/03/16/enter-the-world-of-ajax-solving-problems-with-saving-records/#comment-29</guid>
		<description>Ruby on Rails has built-in support for this sort of thing, with an "in-place field editor" and other support for AJAX. When using the in-place field editor, users simply click the item they want to edit, and it is replaced with an input field. When they click "save" (or press the return/enter key), it is automatically saved server-side. That works well for turning a "view" screen into an "edit" screen quickly and intuitively. The downside is that it allows only single fields to be edited at a time, and doesn't have a solution for tabbing among various input controls. There's other ways to do it though. For example, to can use the "link_to_remote" helper to create a link that causes a portion of the page to be replaced with new content from the server -- an edit form, for example. When the form is saved, it is replaced again with new content from the server -- the updated "view" containing the information entered by the user. You can add an effect (such as the "yellow fade effect" easily to highlight to the user that the content has been saved.

Many of the effects and AJAX features of the Ruby on Rails environment are supplied by the Javascript libraries Prototype and Scriptaculous. They are extremely easy to use from Ruby on Rails, which has support for generating Javascript using Ruby code, and a variety of "helpers" like link_to_remote.

For example, the following line of code from a Rails app displays a link (&lt;a href="" rel="nofollow"&gt;[Edit]&lt;/a&gt;) that, when clicked, causes a div displaying an address to have its content (innerHTML) replaced with a full address editor form fetched from the server.

 div_id, :url =&#62; { :controller=&#62;'common/address', :action =&#62; :address_editor, :id=&#62;address.id }) %&#62;

Easy.</description>
		<content:encoded><![CDATA[<p>Ruby on Rails has built-in support for this sort of thing, with an &#8220;in-place field editor&#8221; and other support for AJAX. When using the in-place field editor, users simply click the item they want to edit, and it is replaced with an input field. When they click &#8220;save&#8221; (or press the return/enter key), it is automatically saved server-side. That works well for turning a &#8220;view&#8221; screen into an &#8220;edit&#8221; screen quickly and intuitively. The downside is that it allows only single fields to be edited at a time, and doesn&#8217;t have a solution for tabbing among various input controls. There&#8217;s other ways to do it though. For example, to can use the &#8220;link_to_remote&#8221; helper to create a link that causes a portion of the page to be replaced with new content from the server &#8212; an edit form, for example. When the form is saved, it is replaced again with new content from the server &#8212; the updated &#8220;view&#8221; containing the information entered by the user. You can add an effect (such as the &#8220;yellow fade effect&#8221; easily to highlight to the user that the content has been saved.</p>
<p>Many of the effects and AJAX features of the Ruby on Rails environment are supplied by the Javascript libraries Prototype and Scriptaculous. They are extremely easy to use from Ruby on Rails, which has support for generating Javascript using Ruby code, and a variety of &#8220;helpers&#8221; like link_to_remote.</p>
<p>For example, the following line of code from a Rails app displays a link (<a href="" rel="nofollow">[Edit]</a>) that, when clicked, causes a div displaying an address to have its content (innerHTML) replaced with a full address editor form fetched from the server.</p>
<p> div_id, :url =&gt; { :controller=&gt;&#8217;common/address&#8217;, :action =&gt; :address_editor, :id=&gt;address.id }) %&gt;</p>
<p>Easy.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
