# Form\_remote\_tag submitting to an rjs file

**URL:** <https://www.ruby-forum.com/t/form-remote-tag-submitting-to-an-rjs-file/97387>\
**Category:** Rails\
**Created:** [July 6, 2006, 7:49pm UTC](https://www.ruby-forum.com/t/form-remote-tag-submitting-to-an-rjs-file/97387 "2006-07-06T19:49:26Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![lazukars](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/eb9ed0/32.png) [@lazukars](https://www.ruby-forum.com/u/lazukars)\
**Post date:** [July 6, 2006, 7:49pm UTC](https://www.ruby-forum.com/t/form-remote-tag-submitting-to-an-rjs-file/97387/1 "2006-07-06T19:49:26Z")

</div>

I have the following form that I am trying to use, but for some reason,  
the form gets submitted with out the params values.

\<%= form\_remote\_tag(:url =\> { :action =\> :add\_item\_to\_order }) %\>

 \<%=collection\_select(:order\_item , :item\_category\_id, @item\_categories, :id, :name)%\> \<%= text\_field 'order\_item', 'quantity', :size =\> "5" %\>

\<%= submit\_tag ‘Add’ %\>

This outputs at the server:

Processing OrderController#add\_item\_to\_order (for 127.0.0.1 at  
2006-07-06 13:40:32) [POST]  
Session ID: 12a539f773a693a5ce75a8a77082e7dd  
Parameters: {“action”=\>“add\_item\_to\_order”, “controller”=\>“order”}

Without any parameters. Can I not submit my form elements with a  
form\_remote\_tag ?

Thanks for the help!  
Ryan

---

<div class="post-metadata">

**Author:** ![lazukars](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/eb9ed0/32.png) [@lazukars](https://www.ruby-forum.com/u/lazukars)\
**Post date:** [July 6, 2006, 8:27pm UTC](https://www.ruby-forum.com/t/form-remote-tag-submitting-to-an-rjs-file/97387/2 "2006-07-06T20:27:31Z")

</div>

Hi Bill,

My code now looks like this:

\<%= form\_remote\_tag( :html =\> { :action =\> url\_for( :action =\>  
:add\_item\_to\_order) }) %\>

 \<%=collection\_select(:order\_item , :item\_category\_id, @item\_categories, :id, :name)%\> \<%= text\_field 'order\_item', 'quantity', :size =\> "5" %\> \<%= submit\_tag 'Add' %\> \<%= end\_form\_tag %\>

and now nothing is being submitted (nothing at all happens when the  
button is pressed.)

Any other ideas?

Thanks!

---

<div class="post-metadata">

**Author:** ![lazukars](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/eb9ed0/32.png) [@lazukars](https://www.ruby-forum.com/u/lazukars)\
**Post date:** [July 6, 2006, 8:09pm UTC](https://www.ruby-forum.com/t/form-remote-tag-submitting-to-an-rjs-file/97387/3 "2006-07-06T20:09:30Z")

</div>

Hi Ryan,

Ryan L. wrote:

> I have the following form that I am trying to use,  
> but for some reason, the form gets submitted with  
> out the params values.
> 
> \<%= form\_remote\_tag(:url =\> { :action =\> :add\_item\_to\_order }) %\>

According to the example in the Rails documentation  
([http://api.rubyonrails.org/](http://api.rubyonrails.org/)) the syntax for form\_remote\_tag is:

form\_remote\_tag :html =\> {:action =\> url\_for(…}}

Then it says… “The Hash passed to the :html key…”

So I think the problem is that your code is not telling it where to pass  
the  
params hash. Try…

\<%= form\_remote\_tag( :html =\> { :action =\> url\_for( :action =\>  
:add\_item\_to\_order) }) %\>

hth,  
Bill

---

<div class="post-metadata">

**Author:** ![lazukars](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/eb9ed0/32.png) [@lazukars](https://www.ruby-forum.com/u/lazukars)\
**Post date:** [July 6, 2006, 8:43pm UTC](https://www.ruby-forum.com/t/form-remote-tag-submitting-to-an-rjs-file/97387/4 "2006-07-06T20:43:51Z")

</div>

Ryan L. wrote:

> Hi Bill,
> 
> My code now looks like this:
> 
> \<%= form\_remote\_tag( :html =\> { :action =\> url\_for( :action =\>  
> :add\_item\_to\_order) }) %\>
> 
> \<%=collection\_select(:order\_item , :item\_category\_id, @item\_categories, :id, :name)%\> \<%= text\_field 'order\_item', 'quantity', :size =\> "5" %\> \<%= submit\_tag 'Add' %\> \<%= end\_form\_tag %\>
> 
> and now nothing is being submitted (nothing at all happens when the  
> button is pressed.)
> 
> Any other ideas?
> 
> Thanks!

What does your add action do?

Look at your development.log file (assuming you’re in development mode)  
to see what the form is passing to the “add” action…any errors?

---

<div class="post-metadata">

**Author:** ![lazukars](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/eb9ed0/32.png) [@lazukars](https://www.ruby-forum.com/u/lazukars)\
**Post date:** [July 6, 2006, 8:58pm UTC](https://www.ruby-forum.com/t/form-remote-tag-submitting-to-an-rjs-file/97387/5 "2006-07-06T20:58:24Z")

</div>

Ryan L. wrote:

> and now nothing is being submitted (nothing at all  
> happens when the button is pressed.)

Ahhh… progress 😉

> Any other ideas?

If you’re not already using it, get Firefox. Then download Firebug. It  
will let you see what’s being sent, what errors are being generated,  
etc.  
One of the challenges with using RJS is that while the error pages  
you’re  
used to getting from Rails are, in fact, being generated, they’re not  
being  
displayed. Firebug will let you see the response.

hth,  
Bill

---

<div class="post-metadata">

**Author:** ![lazukars](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/eb9ed0/32.png) [@lazukars](https://www.ruby-forum.com/u/lazukars)\
**Post date:** [July 6, 2006, 8:51pm UTC](https://www.ruby-forum.com/t/form-remote-tag-submitting-to-an-rjs-file/97387/6 "2006-07-06T20:51:13Z")

</div>

Your not going to believe this, but the reason it wasn’t working was  
because the form was within table tags. Apperently you cannot place the  
form tags within table tags.

(I found it here:

[http://lists.rubyonrails.org/pipermail/rails/2006-May/039186.html](http://lists.rubyonrails.org/pipermail/rails/2006-May/039186.html))

Thanks again for your help, this was driving me mad.

---

<div class="post-metadata">

**Author:** ![lazukars](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/eb9ed0/32.png) [@lazukars](https://www.ruby-forum.com/u/lazukars)\
**Post date:** [July 6, 2006, 9:01pm UTC](https://www.ruby-forum.com/t/form-remote-tag-submitting-to-an-rjs-file/97387/7 "2006-07-06T21:01:49Z")

</div>

Hi Ryan,

Ryan L. wrote:

> Your not going to believe this, but the reason it wasn’t  
> working was because the form was within table tags.

My rather strong advice is stop using tables for layout and move to  
using

 / and CSS for same. I've found http://www.w3schools.com/ to be a tremendous resource for this making it very easy to pick up all the basics. It's also a terriffic resource for understanding the 'html options' you'll find referred to very frequently in the Rails documentation.

Best regards,  
Bill

---

<div class="post-metadata">

**Author:** ![lazukars](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/eb9ed0/32.png) [@lazukars](https://www.ruby-forum.com/u/lazukars)\
**Post date:** [July 6, 2006, 9:30pm UTC](https://www.ruby-forum.com/t/form-remote-tag-submitting-to-an-rjs-file/97387/8 "2006-07-06T21:30:59Z")

</div>

I will take a look at both! Thanks again for your help.
