scott
June 18, 2007, 8:12pm
1
I have a simple form_remote_tag like so:
<% form_remote_tag(:url => {:controller => :contractor, :action =>
“bid_on_project”, :project => @project },
:success =>
“javascript:window.opener.location.reload();javascript:window.close()”)
do %>
<%= @project.name %>
Current high bid: <
%=number_to_currency(@project.current_bid.nil ? ? 0.00 :
@project.current_bid.amount )%>
<%= text_field_tag ‘bid_amount’ %>
<%= submit_tag “send bid”, :name=>“confirm”%>
<%end%>
However, when I submit the form, all I see is:
Parameters: {“project”=>“1”, “action”=>“bid_on_project”,
“controller”=>“contractor”}
The bid_amount param never seems to make it in on the list.
When I use a regular form_tag, this works fine.
Anyone have any ideas?
Thanks,
Scott
scott
June 18, 2007, 8:31pm
2
Scott wrote:
<% form_remote_tag(:url => {:controller => :contractor, :action =>
“bid_on_project”, :project => @project },
:success =>
“javascript:window.opener.location.reload();javascript:window.close()”)
do %>
…
<%= submit_tag “send bid”, :name=>“confirm”%>
…
The bid_amount param never seems to make it in on the list.
I don’t know the complete story, but we took the remote out of the
form_tag, and used submit_to_remote. It stands to reason that the Ajax
now fires from a button. Also, going forward, submit_to_remote fixes
the problem of multiple submits from one form via Ajax.
–
Phlip
Test Driven Ajax (on Rails) [Book]
“Test Driven Ajax (on Rails)”
assert_xpath, assert_javascript, & assert_ajax
scott
June 18, 2007, 8:51pm
3
I tried that and came back with the same problem.
scott
June 19, 2007, 1:31am
4
Scott wrote:
</td>
<%= text_field_tag 'bid_amount' %><br/>
Parameters: {“project”=>“1”, “action”=>“bid_on_project”,
“controller”=>“contractor”}
The bid_amount param never seems to make it in on the list.
When I use a regular form_tag, this works fine.
Wrap your form_remote_tag outside the
element rather than
inside.
–
We develop, watch us RoR, in numbers too big to ignore.