Forum: Ruby on Rails end_form_tag

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Arch S. (Guest)
on 2007-04-03 20:12
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 %>
Niels Meersschaert (Guest)
on 2007-04-03 20:17
(Received via mailing list)
Remove the = it isn't supposed to write out end, only close the loop,
thus you want

<% end %> instead of <%= end %>
Arch S. (Guest)
on 2007-04-03 20:21
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 :(
tharealpatton (Guest)
on 2007-04-03 20:32
(Received via mailing list)
<% 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...
</form>

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:
http://api.rubyonrails.org/classes/ActionView/Help...

Hope this helps.

-PJ
This topic is locked and can not be replied to.