<?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>Floorplanner Tech Blog &#187; form</title>
	<atom:link href="http://techblog.floorplanner.com/tag/form/feed/" rel="self" type="application/rss+xml" />
	<link>http://techblog.floorplanner.com</link>
	<description>Our latest geek adventures!</description>
	<lastBuildDate>Tue, 16 Mar 2010 18:45:44 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Form_remote_tag submit by Javascript</title>
		<link>http://techblog.floorplanner.com/2007/03/22/form_remote_tag-submit-by-javascript/</link>
		<comments>http://techblog.floorplanner.com/2007/03/22/form_remote_tag-submit-by-javascript/#comments</comments>
		<pubDate>Thu, 22 Mar 2007 13:26:54 +0000</pubDate>
		<dc:creator>jaap</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Ajax]]></category>
		<category><![CDATA[form]]></category>

		<guid isPermaLink="false">http://www.suite75.net/blog/dev/?p=10</guid>
		<description><![CDATA[When you try to submit a form from Javascript, using form_remote_tag, like this:
Rails:

form_remote_tag :url =&#62; &#123;:controller =&#62; &#34;somecontroller&#34;, :action =&#62; &#34;} , :html =&#62; {:id =&#62; &#34;ajax-form-1&#34;&#62;

If you just invoke form.submit(), like this:

var form = document.getElementById&#40;'ajax-form-1'&#41;;
if&#40;form&#41;
   form.submit&#40;&#41;;

the form will be submitted to a new page, that&#8217;s not soo ajaxy you now think. Instead [...]]]></description>
			<content:encoded><![CDATA[<p>When you try to submit a form from Javascript, using form_remote_tag, like this:</p>
<p><strong>Rails:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family: Monaco,monospace;">form_remote_tag <span style="color:#ff3333; font-weight:bold;">:url</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#123;</span>:controller <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;somecontroller&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:action</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;} , :html =&gt; {:id =&gt; &quot;</span>ajax<span style="color:#006600; font-weight:bold;">-</span>form<span style="color:#006600; font-weight:bold;">-</span><span style="color:#006666;">1</span><span style="color:#996600;">&quot;&gt;</span></pre></div></div>

<p>If you just invoke <code>form.submit()</code>, like this:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family: Monaco,monospace;"><span style="color: #003366; font-weight: bold;">var</span> form <span style="color: #339933;">=</span> document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'ajax-form-1'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>form<span style="color: #009900;">&#41;</span>
   form.<span style="color: #660066;">submit</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>the form will be submitted to a new page, that&#8217;s not soo ajaxy you now think. Instead use:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family: Monaco,monospace;"><span style="color: #003366; font-weight: bold;">var</span> form <span style="color: #339933;">=</span> document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'ajax-form-1'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>form.<span style="color: #660066;">onsubmit</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
   form.<span style="color: #660066;">submit</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Now your form will be submitted on the AJAX way!</p>
]]></content:encoded>
			<wfw:commentRss>http://techblog.floorplanner.com/2007/03/22/form_remote_tag-submit-by-javascript/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>
