<?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/"
	xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Rails AJAX pre-submit form validation</title>
	<atom:link href="http://hillemania.wordpress.com/2006/09/18/rails-ajax-pre-submit-form-validation/feed/" rel="self" type="application/rss+xml" />
	<link>http://hillemania.wordpress.com/2006/09/18/rails-ajax-pre-submit-form-validation/</link>
	<description>The thoughts of an Interface Engineer trying to find his way</description>
	<lastBuildDate>Fri, 23 Oct 2009 11:06:39 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: SouthWind41</title>
		<link>http://hillemania.wordpress.com/2006/09/18/rails-ajax-pre-submit-form-validation/#comment-1090</link>
		<dc:creator>SouthWind41</dc:creator>
		<pubDate>Fri, 23 Oct 2009 11:06:39 +0000</pubDate>
		<guid isPermaLink="false">http://hillemania.wordpress.com/2006/09/18/rails-ajax-pre-submit-form-validation/#comment-1090</guid>
		<description>Short term employment for youth workers, or even job-creation measures that bring in workers without the proper skills to work with youth, can be counter-productive in terms of creating a successful environment for youth participation. ,</description>
		<content:encoded><![CDATA[<p>Short term employment for youth workers, or even job-creation measures that bring in workers without the proper skills to work with youth, can be counter-productive in terms of creating a successful environment for youth participation. ,</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: No_limits73</title>
		<link>http://hillemania.wordpress.com/2006/09/18/rails-ajax-pre-submit-form-validation/#comment-1089</link>
		<dc:creator>No_limits73</dc:creator>
		<pubDate>Thu, 22 Oct 2009 12:16:56 +0000</pubDate>
		<guid isPermaLink="false">http://hillemania.wordpress.com/2006/09/18/rails-ajax-pre-submit-form-validation/#comment-1089</guid>
		<description>Acceptance of their results relies on the process of obtain- ing the results as well as analysis of the results themselves. ,</description>
		<content:encoded><![CDATA[<p>Acceptance of their results relies on the process of obtain- ing the results as well as analysis of the results themselves. ,</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: name</title>
		<link>http://hillemania.wordpress.com/2006/09/18/rails-ajax-pre-submit-form-validation/#comment-1060</link>
		<dc:creator>name</dc:creator>
		<pubDate>Mon, 01 Sep 2008 05:36:58 +0000</pubDate>
		<guid isPermaLink="false">http://hillemania.wordpress.com/2006/09/18/rails-ajax-pre-submit-form-validation/#comment-1060</guid>
		<description>Good day!,</description>
		<content:encoded><![CDATA[<p>Good day!,</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Floroskop</title>
		<link>http://hillemania.wordpress.com/2006/09/18/rails-ajax-pre-submit-form-validation/#comment-1054</link>
		<dc:creator>Floroskop</dc:creator>
		<pubDate>Wed, 19 Mar 2008 09:08:48 +0000</pubDate>
		<guid isPermaLink="false">http://hillemania.wordpress.com/2006/09/18/rails-ajax-pre-submit-form-validation/#comment-1054</guid>
		<description>Hello! 
I think this try.</description>
		<content:encoded><![CDATA[<p>Hello!<br />
I think this try.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Venkat</title>
		<link>http://hillemania.wordpress.com/2006/09/18/rails-ajax-pre-submit-form-validation/#comment-1053</link>
		<dc:creator>Venkat</dc:creator>
		<pubDate>Thu, 07 Feb 2008 11:06:52 +0000</pubDate>
		<guid isPermaLink="false">http://hillemania.wordpress.com/2006/09/18/rails-ajax-pre-submit-form-validation/#comment-1053</guid>
		<description>Hi all, by reading the above comments, I thought that you all might have successfully implemented javascript validation before submitting form to a remote action. But when I tried this with my app, I was left unsuccessful.
Below is the code I have.
[code]
 {:action =&gt; “does”}, :before =&gt; “validate_form()”, :update =&gt; “update_div” ) %&gt;
input type=&quot;text&quot; name=&quot;name&quot; id=&quot;name&quot;
div updates here
[/code]

In my does.rhtml, I am just displaying some text.

this is my javascript code.
[code]
function validate_form()
{
var name = document.getElementById(’name’).value;
var errors = “”;
if(name != “kishore”)
{
errors+= “invalid name”;
}
if(errors != “”)
{
alert(errors);
return false;
}
}
[/code]
When I enter the correct data, the text is getting rendered successfuly but when data is entered incorrectly, the alert message gets displayed and the request is still getting processed and the div is getting updated with the text. Where am I missing the obvious thing? Any help appreciated. thanks in advance.
Can mail the stuff if the code here is obscure.

regards,
venkat</description>
		<content:encoded><![CDATA[<p>Hi all, by reading the above comments, I thought that you all might have successfully implemented javascript validation before submitting form to a remote action. But when I tried this with my app, I was left unsuccessful.<br />
Below is the code I have.</p>
<pre class="brush: plain;">
 {:action =&gt; “does”}, :before =&gt; “validate_form()”, :update =&gt; “update_div” ) %&gt;
input type="text" name="name" id="name"
div updates here
</pre>
<p>In my does.rhtml, I am just displaying some text.</p>
<p>this is my javascript code.</p>
<pre class="brush: plain;">
function validate_form()
{
var name = document.getElementById(’name’).value;
var errors = “”;
if(name != “kishore”)
{
errors+= “invalid name”;
}
if(errors != “”)
{
alert(errors);
return false;
}
}
</pre>
<p>When I enter the correct data, the text is getting rendered successfuly but when data is entered incorrectly, the alert message gets displayed and the request is still getting processed and the div is getting updated with the text. Where am I missing the obvious thing? Any help appreciated. thanks in advance.<br />
Can mail the stuff if the code here is obscure.</p>
<p>regards,<br />
venkat</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kori</title>
		<link>http://hillemania.wordpress.com/2006/09/18/rails-ajax-pre-submit-form-validation/#comment-747</link>
		<dc:creator>kori</dc:creator>
		<pubDate>Sat, 22 Sep 2007 08:01:40 +0000</pubDate>
		<guid isPermaLink="false">http://hillemania.wordpress.com/2006/09/18/rails-ajax-pre-submit-form-validation/#comment-747</guid>
		<description>Hope you come back soon!!  &lt;a href=&quot;http://notem6715.info&quot; rel=&quot;nofollow&quot;&gt;notem6715&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>Hope you come back soon!!  <a href="http://notem6715.info" rel="nofollow">notem6715</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: hillemania</title>
		<link>http://hillemania.wordpress.com/2006/09/18/rails-ajax-pre-submit-form-validation/#comment-40</link>
		<dc:creator>hillemania</dc:creator>
		<pubDate>Mon, 06 Nov 2006 04:42:51 +0000</pubDate>
		<guid isPermaLink="false">http://hillemania.wordpress.com/2006/09/18/rails-ajax-pre-submit-form-validation/#comment-40</guid>
		<description>Thanks Kellybluebook, I&#039;m glad some people are reading it and enjoying it.</description>
		<content:encoded><![CDATA[<p>Thanks Kellybluebook, I&#8217;m glad some people are reading it and enjoying it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kellybluebook</title>
		<link>http://hillemania.wordpress.com/2006/09/18/rails-ajax-pre-submit-form-validation/#comment-36</link>
		<dc:creator>kellybluebook</dc:creator>
		<pubDate>Tue, 24 Oct 2006 06:13:12 +0000</pubDate>
		<guid isPermaLink="false">http://hillemania.wordpress.com/2006/09/18/rails-ajax-pre-submit-form-validation/#comment-36</guid>
		<description>good site!</description>
		<content:encoded><![CDATA[<p>good site!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeff</title>
		<link>http://hillemania.wordpress.com/2006/09/18/rails-ajax-pre-submit-form-validation/#comment-16</link>
		<dc:creator>Jeff</dc:creator>
		<pubDate>Thu, 28 Sep 2006 19:34:46 +0000</pubDate>
		<guid isPermaLink="false">http://hillemania.wordpress.com/2006/09/18/rails-ajax-pre-submit-form-validation/#comment-16</guid>
		<description>your code snippet is a little hard to read, just wanted to make sure you are calling :before =&gt; &quot;ValidateForm()&quot; and not just , &quot;ValidateForm()&quot;</description>
		<content:encoded><![CDATA[<p>your code snippet is a little hard to read, just wanted to make sure you are calling :before =&gt; &#8220;ValidateForm()&#8221; and not just , &#8220;ValidateForm()&#8221;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Buffalo</title>
		<link>http://hillemania.wordpress.com/2006/09/18/rails-ajax-pre-submit-form-validation/#comment-15</link>
		<dc:creator>Buffalo</dc:creator>
		<pubDate>Thu, 28 Sep 2006 17:10:51 +0000</pubDate>
		<guid isPermaLink="false">http://hillemania.wordpress.com/2006/09/18/rails-ajax-pre-submit-form-validation/#comment-15</guid>
		<description>I have been banging my head against this solution all morning, I just cant seem to get it to work.

The following combination of the form_remote_tag, :before, and javascript causes the form to still submit and the action to execute. 

Mind to have a look and tell me if I am missing something obvious? I am new to ruby on rails , but relatively adept at javascript, I am hoping I am just doing something blatently wrong .. Thanks! Feel free to email me or I can check back here.

# the form tag
 &quot;ValidateForm()&quot;,
              :url =&gt; { :action =&gt; &quot;execute&quot; },
              ...
) %&gt;

# the javascript
function ValidateForm() {
   ...
   return false
}</description>
		<content:encoded><![CDATA[<p>I have been banging my head against this solution all morning, I just cant seem to get it to work.</p>
<p>The following combination of the form_remote_tag, :before, and javascript causes the form to still submit and the action to execute. </p>
<p>Mind to have a look and tell me if I am missing something obvious? I am new to ruby on rails , but relatively adept at javascript, I am hoping I am just doing something blatently wrong .. Thanks! Feel free to email me or I can check back here.</p>
<p># the form tag<br />
 &#8220;ValidateForm()&#8221;,<br />
              :url =&gt; { :action =&gt; &#8220;execute&#8221; },<br />
              &#8230;<br />
) %&gt;</p>
<p># the javascript<br />
function ValidateForm() {<br />
   &#8230;<br />
   return false<br />
}</p>
]]></content:encoded>
	</item>
</channel>
</rss>
