End_form_tag

In my logs I can see that end_form_tag is being deprecated. I wanted to
make the switch now but cannot get the new end tag to work.

THIS WORKS:

<%= form_remote_tag :url =>{:action => "next_question",
                            :kwiz_id => @kwiz.id,
                            :position => @next_position} %>

    <% @question.choices.each do |choice| -%>
        <%= radio_button_tag "choice_id", choice.id %>
        <%= choice.name %><br />
    <% end -%>
    <br />
    <%= submit_tag "Next Question" %>
<%= end_form_tag %>

THIS DOES NOT WORK:

<%= form_remote_tag :url =>{:action => "next_question",
                            :kwiz_id => @kwiz.id,
                            :position => @next_position} %>

    <% @question.choices.each do |choice| -%>
        <%= radio_button_tag "choice_id", choice.id %>
        <%= choice.name %><br />
    <% end -%>
    <br />
    <%= submit_tag "Next Question" %>
<%= end %>

Remove the = it isn’t supposed to write out end, only close the loop,
thus you want

<% end %> instead of <%= end %>

Niels Meersschaert wrote:

Remove the = it isn’t supposed to write out end, only close the loop,
thus you want

<% end %> instead of <%= end %>

That doesn’t work either :frowning:

<% form_remote_tag :url =>{:action => “next_question”} do %>

Form contents…

<% end %>

Form tag helpers should not use <%= %> if you’re trying to pass them a
block. They should use <% %>.

Alternatively, you could use:

<%= form_remote_tag :url =>{:action => “next_question”} %>

Form contents…

But that’s not as pretty. See DHH’s article on the topic:
http://www.loudthinking.com/arc/2006_10.html

See also the following for examples of the syntax:

Hope this helps.

-PJ