Scott18
(Scott)
June 18, 2007, 6:11pm
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 %>
<tr>
<td>
<%= @project.name %>
</td>
</tr>
<tr>
<td>
Current high bid: <
%=number_to_currency(@project.current_bid.nil ? ? 0.00 :
@project.current_bid.amount )%><br/>
</td>
</tr>
<tr>
<td>
<%= text_field_tag 'bid_amount' %><br/>
</td>
</tr>
<tr>
<td>
<%= submit_tag "send bid", :name=>"confirm"%><br/>
</td>
</tr>
<%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
Phlip
(Phlip)
June 18, 2007, 6: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"%><br/>
...
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.
Scott18
(Scott)
June 18, 2007, 6:50pm
3
I tried that and came back with the same problem.
Scott wrote:
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 %>
<tr>
<td>
<%= @project.name %>
</td>
</tr>
<tr>
<td>
Current high bid: <
%=number_to_currency(@project.current_bid.nil ? ? 0.00 :
@project.current_bid.amount )%><br/>
</td>
</tr>
<tr>
<td>
<%= text_field_tag 'bid_amount' %><br/>
</td>
</tr>
<tr>
<td>
<%= submit_tag "send bid", :name=>"confirm"%><br/>
</td>
</tr>
<%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.
Wrap your form_remote_tag outside the <table> element rather than
inside.