mike
November 30, 2006, 8:35pm
1
Hello,
I am trying to implement the depot sample application of “Agile
programming with rails”, everrithing goes good until came to AJAX
stuff,
When I changed the button_to for submit_tag I have no HTML code
generated for invoking the action using AJAX, I read the
troubleshooting section and everything is OK, any Idea of what could be
happening?
The code in index.rhml is
<% form_remote_tag :url => {:action => :add_to_cart, :id => product
} do %>
<%= submit_tag “Add to Cart” %>
<% end %>
and the resulting form has nothing, just a couple of blank lines in the
place that should show the button.
Thank you
mike
November 30, 2006, 8:53pm
2
Mike wrote:
<% form_remote_tag :url =>
You forgot the =
(Some forms use it and some don’t. No idea why!)
–
Phlip
Redirecting... ← NOT a blog!!!
mike
November 30, 2006, 9:01pm
3
(Some forms use it and some don’t. No idea why!)
<% form_for :item %>
…
<% end %>
Is a block, so it doesn’t use the =. It outputs what’s inside the block.
<%= form_remote_tag %>
Doesn’t have a block, it’s directly outputting the tag itself.
mike
November 30, 2006, 9:01pm
4
Philip,
I tried two ways, and when use "=" sends an error
SyntaxError in Store#index
Showing app/views/store/index.rhtml where line #13 raised:
compile error
./script/…/config/…/app/views/store/index.rhtml:13: parse error,
unexpected ‘)’
_erbout.concat " "; _erbout.concat(( form_remote_tag :url =>
{:action => :add_to_cart, :id => product } do ).to_s); _erbout.concat
“\n”
^
./script/…/config/…/app/views/store/index.rhtml:18: parse error,
unexpected kEND, expecting ‘)’
end ; _erbout
^
Any other idea?
Phlip ha escrito:
mike
November 30, 2006, 9:07pm
5
Jim,
The code is
<% form_remote_tag :url => {:action => :add_to_cart, :id => product }
do %>
<%= submit_tag “Add to Cart” %>
<% end %>
it should generate a form with a submit button, but it doesn’t generate
any HTML code, just two blank lines, seems weird, isn’t?
Thank you
mike
November 30, 2006, 9:03pm
6
I tried two ways, and when use "=" sends an error
^
./script/…/config/…/app/views/store/index.rhtml:18: parse error,
unexpected kEND, expecting ‘)’
end ; _erbout
^
take off the <% end %> tag, after you switch from <% form_remote_tag
%> to <%= form_remote_tag %>
mike
December 2, 2006, 7:20am
7
On 12/1/06, Mike [email protected] wrote:
it should generate a form with a submit button, but it doesn’t generate
any HTML code, just two blank lines, seems weird, isn’t?
I am using
<%= form_tag :action => :agent_call_list%>
<%= submit_tag -%>
<%= end_form_tag %>
raj