<?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: Q&amp;A: How to Set a Form&#8217;s ID in Rails?</title>
	<atom:link href="http://3dmdesign.com/development/qa-how-to-set-form-id-in-rails/feed" rel="self" type="application/rss+xml" />
	<link>http://3dmdesign.com/development/qa-how-to-set-form-id-in-rails</link>
	<description>JavaScript and Ruby on Rails Web Applications</description>
	<lastBuildDate>Thu, 03 Dec 2009 10:43:06 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: Scott - 3DM Design</title>
		<link>http://3dmdesign.com/development/qa-how-to-set-form-id-in-rails/comment-page-1#comment-12916</link>
		<dc:creator>Scott - 3DM Design</dc:creator>
		<pubDate>Thu, 26 Nov 2009 00:42:26 +0000</pubDate>
		<guid isPermaLink="false">http://3dmdesign.com/dev-journal/rails-application-development/qa-how-to-set-form-id-in-rails#comment-12916</guid>
		<description>Okay, I think I see where you&#039;re trying to get to.

In my opinion this is something that should be handled purely in JavaScript, you don&#039;t need to get the server involved (beyond the usual form submission/Ajax request), and it&#039;s simpler too.

If you&#039;re using &lt;a href=&quot;http://prototypejs.org/&quot; rel=&quot;nofollow&quot;&gt;Prototype&lt;/a&gt; you just do something like this in the onSuccess callback of your Ajax.request:

&lt;code&gt;$(&#039;form_id&#039;).remove();&lt;/code&gt;

Of course, that assumes you&#039;re comfortable writing a bit of JavaScript, including some unobtrusive code to, say, observe the form&#039;s submit event and send the Ajax request yourself. It&#039;s not the only option but that&#039;s the route I&#039;d recommend.</description>
		<content:encoded><![CDATA[<p>Okay, I think I see where you&#8217;re trying to get to.</p>
<p>In my opinion this is something that should be handled purely in JavaScript, you don&#8217;t need to get the server involved (beyond the usual form submission/Ajax request), and it&#8217;s simpler too.</p>
<p>If you&#8217;re using <a href="http://prototypejs.org/" rel="nofollow">Prototype</a> you just do something like this in the onSuccess callback of your Ajax.request:</p>
<p><code>$('form_id').remove();</code></p>
<p>Of course, that assumes you&#8217;re comfortable writing a bit of JavaScript, including some unobtrusive code to, say, observe the form&#8217;s submit event and send the Ajax request yourself. It&#8217;s not the only option but that&#8217;s the route I&#8217;d recommend.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cosmo</title>
		<link>http://3dmdesign.com/development/qa-how-to-set-form-id-in-rails/comment-page-1#comment-12645</link>
		<dc:creator>Cosmo</dc:creator>
		<pubDate>Thu, 12 Nov 2009 00:40:42 +0000</pubDate>
		<guid isPermaLink="false">http://3dmdesign.com/dev-journal/rails-application-development/qa-how-to-set-form-id-in-rails#comment-12645</guid>
		<description>Scott:

Ah, I see that we&#039;re talking about different directions of communication.  In the case you are talking about, you&#039;re addressing passing the id from Rails to the HTML code (via the :html option of the view code).

In my case I want to communicate the form&#039;s id upon submission to the rails controller.  This is so that I can run some JS code to interact with the element (specifically to delete the form from the web page).

I&#039;ve been doing this in the view via the :url option like this:

  % form_remote_tag :url=&gt; { :action =&gt; &#039;remove_element&#039;, :element_id =&gt; id } do %


In the controller I then delete the form from the web page:

  def remove_element
    page.remove element_id 
  end

What I&#039;m wondering is whether I&#039;m doing unnecessary work?  Do I need to manually pass the id of the form to the controller like this or is there some other Rails-magical way that automatically makes information (such as form and element ids) available to the controller?  

I don&#039;t see any such data in the params[] hash, but perhaps I&#039;m overlooking something?

I&#039;m not crazy about the way I&#039;m doing it because the element id appears in the URL.  Perhaps it should be in a hidden field so it&#039;s passed in the POST data?

What would be the &quot;Rails way&quot; of doing this?

TIA</description>
		<content:encoded><![CDATA[<p>Scott:</p>
<p>Ah, I see that we&#8217;re talking about different directions of communication.  In the case you are talking about, you&#8217;re addressing passing the id from Rails to the HTML code (via the :html option of the view code).</p>
<p>In my case I want to communicate the form&#8217;s id upon submission to the rails controller.  This is so that I can run some JS code to interact with the element (specifically to delete the form from the web page).</p>
<p>I&#8217;ve been doing this in the view via the :url option like this:</p>
<p>  % form_remote_tag :url=&gt; { :action =&gt; &#8216;remove_element&#8217;, :element_id =&gt; id } do %</p>
<p>In the controller I then delete the form from the web page:</p>
<p>  def remove_element<br />
    page.remove element_id<br />
  end</p>
<p>What I&#8217;m wondering is whether I&#8217;m doing unnecessary work?  Do I need to manually pass the id of the form to the controller like this or is there some other Rails-magical way that automatically makes information (such as form and element ids) available to the controller?  </p>
<p>I don&#8217;t see any such data in the params[] hash, but perhaps I&#8217;m overlooking something?</p>
<p>I&#8217;m not crazy about the way I&#8217;m doing it because the element id appears in the URL.  Perhaps it should be in a hidden field so it&#8217;s passed in the POST data?</p>
<p>What would be the &#8220;Rails way&#8221; of doing this?</p>
<p>TIA</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Scott - 3DM Design</title>
		<link>http://3dmdesign.com/development/qa-how-to-set-form-id-in-rails/comment-page-1#comment-12475</link>
		<dc:creator>Scott - 3DM Design</dc:creator>
		<pubDate>Fri, 06 Nov 2009 01:55:50 +0000</pubDate>
		<guid isPermaLink="false">http://3dmdesign.com/dev-journal/rails-application-development/qa-how-to-set-form-id-in-rails#comment-12475</guid>
		<description>Yeah, I don&#039;t have a good plugin for handling code in the comments on the blog yet - and I&#039;m sorry the comment form doesn&#039;t state such limitations.

I&#039;m probably not doing a good job explaining - in your controller action that&#039;s receiving the form submission you can receive a &lt;em&gt;value&lt;/em&gt; for each &lt;em&gt;input&lt;/em&gt; in the form&#039;s HTML.

So from the controller, the action can assign:

&lt;code&gt;element_id = params[:element_id]&lt;/code&gt;

To be able to do that, your HTML might look something like:

&lt;code&gt;&lt;form action=&quot;...&quot;&gt;
&#160; &lt;input name=&quot;element_id&quot; type=&quot;...&quot;&gt;
&#160; ...
&lt;/form&gt;&lt;/code&gt;

But with Rails your forms are usually built around creating or editing a model object. This means your form HTML is probably going to look more like this:

&lt;code&gt;&lt;form action=&quot;...&quot;&gt;
&#160; &lt;input name=&quot;element[id]&quot; type=&quot;...&quot;&gt;
&#160; ...
&lt;/form&gt;&lt;/code&gt;

In turn, to produce that HTML your view could contain code looking a little like:

&lt;code&gt;&lt;% form_for(@element) do &#124;f&#124; %&gt;
&#160; &lt;%= f.text_field :id ... %&gt;
&#160; ...
&#160; &lt;%= f.submit &quot;Submit&quot; %&gt;
&lt;/code&gt;

And then in your controller you can just do:

&lt;code&gt;element_like = params[:element]&lt;/code&gt;

If you just want the data as some bare object; instead you&#039;ll probably want to instantiate a model object, and probably store it in an instance var too:

&lt;code&gt;@element = Element.new(params[:element])&lt;/code&gt;

You might take a look at the Rails API docs for more examples with &lt;a href=&quot;http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#M001607&quot; rel=&quot;nofollow&quot;&gt;text_field&lt;/a&gt;.

Hope this helps.</description>
		<content:encoded><![CDATA[<p>Yeah, I don&#8217;t have a good plugin for handling code in the comments on the blog yet &#8211; and I&#8217;m sorry the comment form doesn&#8217;t state such limitations.</p>
<p>I&#8217;m probably not doing a good job explaining &#8211; in your controller action that&#8217;s receiving the form submission you can receive a <em>value</em> for each <em>input</em> in the form&#8217;s HTML.</p>
<p>So from the controller, the action can assign:</p>
<p><code>element_id = params[:element_id]</code></p>
<p>To be able to do that, your HTML might look something like:</p>
<p><code>&lt;form action="..."&gt;<br />
&nbsp; &lt;input name="element_id" type="..."&gt;<br />
&nbsp; ...<br />
&lt;/form&gt;</code></p>
<p>But with Rails your forms are usually built around creating or editing a model object. This means your form HTML is probably going to look more like this:</p>
<p><code>&lt;form action="..."&gt;<br />
&nbsp; &lt;input name="element[id]" type="..."&gt;<br />
&nbsp; ...<br />
&lt;/form&gt;</code></p>
<p>In turn, to produce that HTML your view could contain code looking a little like:</p>
<p><code>&lt;% form_for(@element) do |f| %&gt;<br />
&nbsp; &lt;%= f.text_field :id ... %&gt;<br />
&nbsp; ...<br />
&nbsp; &lt;%= f.submit "Submit" %&gt;<br />
</code></p>
<p>And then in your controller you can just do:</p>
<p><code>element_like = params[:element]</code></p>
<p>If you just want the data as some bare object; instead you&#8217;ll probably want to instantiate a model object, and probably store it in an instance var too:</p>
<p><code>@element = Element.new(params[:element])</code></p>
<p>You might take a look at the Rails API docs for more examples with <a href="http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#M001607" rel="nofollow">text_field</a>.</p>
<p>Hope this helps.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cosmo</title>
		<link>http://3dmdesign.com/development/qa-how-to-set-form-id-in-rails/comment-page-1#comment-12456</link>
		<dc:creator>Cosmo</dc:creator>
		<pubDate>Wed, 04 Nov 2009 16:48:26 +0000</pubDate>
		<guid isPermaLink="false">http://3dmdesign.com/dev-journal/rails-application-development/qa-how-to-set-form-id-in-rails#comment-12456</guid>
		<description>Grrrrr.....  How do I de-munge HTML tags in these posts?  Here it is w/o the ERB tag darts:


  % form_remote_tag( :url=&gt; {:action =&gt; &#039;remove_element&#039;}, :html=&gt; {:element_id =&gt; &#039;STUFF&#039;} )  do %

    %= text_field_tag :answer, &#039;Default Answer&#039; %
    %= submit_tag &#039;Submit&#039; %
  % end %</description>
		<content:encoded><![CDATA[<p>Grrrrr&#8230;..  How do I de-munge HTML tags in these posts?  Here it is w/o the ERB tag darts:</p>
<p>  % form_remote_tag( :url=&gt; {:action =&gt; &#8216;remove_element&#8217;}, :html=&gt; {:element_id =&gt; &#8216;STUFF&#8217;} )  do %</p>
<p>    %= text_field_tag :answer, &#8216;Default Answer&#8217; %<br />
    %= submit_tag &#8216;Submit&#8217; %<br />
  % end %</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cosmo</title>
		<link>http://3dmdesign.com/development/qa-how-to-set-form-id-in-rails/comment-page-1#comment-12455</link>
		<dc:creator>Cosmo</dc:creator>
		<pubDate>Wed, 04 Nov 2009 16:42:31 +0000</pubDate>
		<guid isPermaLink="false">http://3dmdesign.com/dev-journal/rails-application-development/qa-how-to-set-form-id-in-rails#comment-12455</guid>
		<description>Lemme try escaping the darts w/ backslash...

  \ {:action =&gt; &#039;remove_element&#039;}, :html=&gt; {:element_id =&gt; &#039;STUFF&#039;} )  do %\&gt;

    \
    \
  \</description>
		<content:encoded><![CDATA[<p>Lemme try escaping the darts w/ backslash&#8230;</p>
<p>  \ {:action =&gt; &#8216;remove_element&#8217;}, :html=&gt; {:element_id =&gt; &#8216;STUFF&#8217;} )  do %\&gt;</p>
<p>    \<br />
    \<br />
  \</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cosmo</title>
		<link>http://3dmdesign.com/development/qa-how-to-set-form-id-in-rails/comment-page-1#comment-12454</link>
		<dc:creator>Cosmo</dc:creator>
		<pubDate>Wed, 04 Nov 2009 16:38:52 +0000</pubDate>
		<guid isPermaLink="false">http://3dmdesign.com/dev-journal/rails-application-development/qa-how-to-set-form-id-in-rails#comment-12454</guid>
		<description>Hmm, that view code got munged by the post -try again:


   {:action =&gt; &#039;remove_element&#039;}, :html=&gt; {:element_id =&gt; &#039;STUFF&#039;} )  do %&gt;

    
    
  </description>
		<content:encoded><![CDATA[<p>Hmm, that view code got munged by the post -try again:</p>
<p>   {:action =&gt; &#8216;remove_element&#8217;}, :html=&gt; {:element_id =&gt; &#8216;STUFF&#8217;} )  do %&gt;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cosmo</title>
		<link>http://3dmdesign.com/development/qa-how-to-set-form-id-in-rails/comment-page-1#comment-12453</link>
		<dc:creator>Cosmo</dc:creator>
		<pubDate>Wed, 04 Nov 2009 16:34:50 +0000</pubDate>
		<guid isPermaLink="false">http://3dmdesign.com/dev-journal/rails-application-development/qa-how-to-set-form-id-in-rails#comment-12453</guid>
		<description>Scott:

Hmmm, please forgive my newbie-ness, perhaps I&#039;m misunderstanding or maybe making a beginner&#039;s error...

Here I&#039;m passing the arbitrary value :element_id via the form as you describe, via the :html hash.  I then try to access the value from the controller via params[:element_id].  But the value comes up blank for me when I write it out to the logger.  The value for :element_id doesn&#039;t appear in params[] at all..


view:

 {:action =&gt; &#039;remove_element&#039;}, :html=&gt; {:element_id =&gt; &#039;STUFF&#039;} )  do %&gt;
  
  



controller:

def remove_element
  element_id = params[:element_id]
  logger.info  &quot;element_id is #{element_id}&quot;
  logger.info( &#039;params[]: &#039; + params.to_a.join(&#039;, &#039;) )
end


log:

element_id is 
params[]: commit, Submit, answer, Default Answer, authenticity_token, NMX9HWoXEFrz4qDXvx6SpRnM2Z73bapzn1NBRO2JPvc=, action, remove_element, controller, set

Am I misunderstanding something here??</description>
		<content:encoded><![CDATA[<p>Scott:</p>
<p>Hmmm, please forgive my newbie-ness, perhaps I&#8217;m misunderstanding or maybe making a beginner&#8217;s error&#8230;</p>
<p>Here I&#8217;m passing the arbitrary value :element_id via the form as you describe, via the :html hash.  I then try to access the value from the controller via params[:element_id].  But the value comes up blank for me when I write it out to the logger.  The value for :element_id doesn&#8217;t appear in params[] at all..</p>
<p>view:</p>
<p> {:action =&gt; &#8216;remove_element&#8217;}, :html=&gt; {:element_id =&gt; &#8216;STUFF&#8217;} )  do %&gt;</p>
<p>controller:</p>
<p>def remove_element<br />
  element_id = params[:element_id]<br />
  logger.info  &#8220;element_id is #{element_id}&#8221;<br />
  logger.info( &#8216;params[]: &#8216; + params.to_a.join(&#8216;, &#8216;) )<br />
end</p>
<p>log:</p>
<p>element_id is<br />
params[]: commit, Submit, answer, Default Answer, authenticity_token, NMX9HWoXEFrz4qDXvx6SpRnM2Z73bapzn1NBRO2JPvc=, action, remove_element, controller, set</p>
<p>Am I misunderstanding something here??</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Scott - 3DM Design</title>
		<link>http://3dmdesign.com/development/qa-how-to-set-form-id-in-rails/comment-page-1#comment-12438</link>
		<dc:creator>Scott - 3DM Design</dc:creator>
		<pubDate>Wed, 04 Nov 2009 02:51:13 +0000</pubDate>
		<guid isPermaLink="false">http://3dmdesign.com/dev-journal/rails-application-development/qa-how-to-set-form-id-in-rails#comment-12438</guid>
		<description>Cosmo:

The original post features both form_tag and form_remote_tag, as the :html hash applies to both.

The :yummy =&gt; &#039;yumminess&#039; example was only included in the post to point out that you can add any arbitrary attributes (you could potentially interact with some JavaScript frameworks in this way).

To work with a form value in your Rails controller you could use params[:yummy], assuming your form has an input (like a textbox) named &quot;yummy&quot;.</description>
		<content:encoded><![CDATA[<p>Cosmo:</p>
<p>The original post features both form_tag and form_remote_tag, as the :html hash applies to both.</p>
<p>The :yummy => &#8216;yumminess&#8217; example was only included in the post to point out that you can add any arbitrary attributes (you could potentially interact with some JavaScript frameworks in this way).</p>
<p>To work with a form value in your Rails controller you could use params[:yummy], assuming your form has an input (like a textbox) named &#8220;yummy&#8221;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cosmo</title>
		<link>http://3dmdesign.com/development/qa-how-to-set-form-id-in-rails/comment-page-1#comment-12272</link>
		<dc:creator>Cosmo</dc:creator>
		<pubDate>Sat, 31 Oct 2009 21:43:22 +0000</pubDate>
		<guid isPermaLink="false">http://3dmdesign.com/dev-journal/rails-application-development/qa-how-to-set-form-id-in-rails#comment-12272</guid>
		<description>Note: your follow-up post was for the &#039;form_tag&#039; helper, not the &#039;form_remote_tag&#039; helper used in the original post.


Here&#039;s my question - once you&#039;ve passed the value, say by { :yummy =&gt; &#039;yumminess&#039; }, how do you then access the values in the controller? 

I&#039;ve tried params[:yummy], but it doesn&#039;t seem to be there.  I know it&#039;s hiding in there somewhere...Thanks</description>
		<content:encoded><![CDATA[<p>Note: your follow-up post was for the &#8216;form_tag&#8217; helper, not the &#8216;form_remote_tag&#8217; helper used in the original post.</p>
<p>Here&#8217;s my question &#8211; once you&#8217;ve passed the value, say by { :yummy =&gt; &#8216;yumminess&#8217; }, how do you then access the values in the controller? </p>
<p>I&#8217;ve tried params[:yummy], but it doesn&#8217;t seem to be there.  I know it&#8217;s hiding in there somewhere&#8230;Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Scott - 3DM Design</title>
		<link>http://3dmdesign.com/development/qa-how-to-set-form-id-in-rails/comment-page-1#comment-9668</link>
		<dc:creator>Scott - 3DM Design</dc:creator>
		<pubDate>Tue, 24 Feb 2009 02:22:15 +0000</pubDate>
		<guid isPermaLink="false">http://3dmdesign.com/dev-journal/rails-application-development/qa-how-to-set-form-id-in-rails#comment-9668</guid>
		<description>You bet, and thanks for stopping by Jon!</description>
		<content:encoded><![CDATA[<p>You bet, and thanks for stopping by Jon!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon</title>
		<link>http://3dmdesign.com/development/qa-how-to-set-form-id-in-rails/comment-page-1#comment-9666</link>
		<dc:creator>Jon</dc:creator>
		<pubDate>Mon, 23 Feb 2009 12:28:49 +0000</pubDate>
		<guid isPermaLink="false">http://3dmdesign.com/dev-journal/rails-application-development/qa-how-to-set-form-id-in-rails#comment-9666</guid>
		<description>Thanks! Just the trick.</description>
		<content:encoded><![CDATA[<p>Thanks! Just the trick.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex</title>
		<link>http://3dmdesign.com/development/qa-how-to-set-form-id-in-rails/comment-page-1#comment-833</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Wed, 25 Apr 2007 08:32:33 +0000</pubDate>
		<guid isPermaLink="false">http://3dmdesign.com/dev-journal/rails-application-development/qa-how-to-set-form-id-in-rails#comment-833</guid>
		<description>Thank You</description>
		<content:encoded><![CDATA[<p>Thank You</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Scott - 3DM Design</title>
		<link>http://3dmdesign.com/development/qa-how-to-set-form-id-in-rails/comment-page-1#comment-169</link>
		<dc:creator>Scott - 3DM Design</dc:creator>
		<pubDate>Tue, 27 Feb 2007 01:52:34 +0000</pubDate>
		<guid isPermaLink="false">http://3dmdesign.com/dev-journal/rails-application-development/qa-how-to-set-form-id-in-rails#comment-169</guid>
		<description>You&#039;re welcome, glad you found it useful Jonathon!</description>
		<content:encoded><![CDATA[<p>You&#8217;re welcome, glad you found it useful Jonathon!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jonathon Wolfe</title>
		<link>http://3dmdesign.com/development/qa-how-to-set-form-id-in-rails/comment-page-1#comment-153</link>
		<dc:creator>Jonathon Wolfe</dc:creator>
		<pubDate>Sat, 24 Feb 2007 18:41:20 +0000</pubDate>
		<guid isPermaLink="false">http://3dmdesign.com/dev-journal/rails-application-development/qa-how-to-set-form-id-in-rails#comment-153</guid>
		<description>Thanks! This really helped me. My book doesn&#039;t mention the :html hash either.</description>
		<content:encoded><![CDATA[<p>Thanks! This really helped me. My book doesn&#8217;t mention the :html hash either.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Scott - 3DM Design</title>
		<link>http://3dmdesign.com/development/qa-how-to-set-form-id-in-rails/comment-page-1#comment-13</link>
		<dc:creator>Scott - 3DM Design</dc:creator>
		<pubDate>Sat, 27 Jan 2007 23:34:49 +0000</pubDate>
		<guid isPermaLink="false">http://3dmdesign.com/dev-journal/rails-application-development/qa-how-to-set-form-id-in-rails#comment-13</guid>
		<description>Jen:

With a standard form you can do this:

&lt;code&gt;&lt;%= form_tag({ :action =&gt; :create }, { :onsubmit =&gt; &#039;&lt;em&gt;function call&lt;/em&gt;&#039; }) %&gt;&lt;/code&gt;

However you probably noticed that if you try using &lt;strong&gt;:onsubmit&lt;/strong&gt; with &lt;strong&gt;form_remote_tag()&lt;/strong&gt;, your event handler gets replaced with the Ajax handler set up by Rails.

One option for Ajax may be to use the &lt;strong&gt;:before&lt;/strong&gt; callback, which should allow you to call a function before the request is made. I haven&#039;t tested it, but that may be what you&#039;re looking for.</description>
		<content:encoded><![CDATA[<p>Jen:</p>
<p>With a standard form you can do this:</p>
<p><code>&lt;%= form_tag({ :action =&gt; :create }, { :onsubmit =&gt; '<em>function call</em>&#39; }) %&gt;</code></p>
<p>However you probably noticed that if you try using <strong>:onsubmit</strong> with <strong>form_remote_tag()</strong>, your event handler gets replaced with the Ajax handler set up by Rails.</p>
<p>One option for Ajax may be to use the <strong>:before</strong> callback, which should allow you to call a function before the request is made. I haven&#8217;t tested it, but that may be what you&#8217;re looking for.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jennifer</title>
		<link>http://3dmdesign.com/development/qa-how-to-set-form-id-in-rails/comment-page-1#comment-12</link>
		<dc:creator>jennifer</dc:creator>
		<pubDate>Fri, 26 Jan 2007 08:58:53 +0000</pubDate>
		<guid isPermaLink="false">http://3dmdesign.com/dev-journal/rails-application-development/qa-how-to-set-form-id-in-rails#comment-12</guid>
		<description>i am trying to do something similar, but perhaps really wrongheaded. i want to call a javascript function on a rails submit; before the form is submitted i want to dynamically add fields and then send their values. i&#039;d love to use an ajax remote_form_tag to generate the form. i&#039;ve been looking at the html options hash also but can&#039;t find any way of doing something like :onsubmit =&gt; &quot;call javascript function&quot;.

do you have any thoughts on this? any help would be much appreciated.

thanks,
jen</description>
		<content:encoded><![CDATA[<p>i am trying to do something similar, but perhaps really wrongheaded. i want to call a javascript function on a rails submit; before the form is submitted i want to dynamically add fields and then send their values. i&#8217;d love to use an ajax remote_form_tag to generate the form. i&#8217;ve been looking at the html options hash also but can&#8217;t find any way of doing something like :onsubmit =&gt; &#8220;call javascript function&#8221;.</p>
<p>do you have any thoughts on this? any help would be much appreciated.</p>
<p>thanks,<br />
jen</p>
]]></content:encoded>
	</item>
</channel>
</rss>
