# End\_form\_tag

**URL:** <https://www.ruby-forum.com/t/end-form-tag/90997>\
**Category:** Rails\
**Created:** [April 3, 2007, 6:12pm UTC](https://www.ruby-forum.com/t/end-form-tag/90997 "2007-04-03T18:12:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![d6veteran](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/94ad74/32.png) [@d6veteran](https://www.ruby-forum.com/u/d6veteran)\
**Post date:** [April 3, 2007, 6:12pm UTC](https://www.ruby-forum.com/t/end-form-tag/90997/1 "2007-04-03T18:12:59Z")

</div>

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 %>
```

---

<div class="post-metadata">

**Author:** ![d6veteran](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/94ad74/32.png) [@d6veteran](https://www.ruby-forum.com/u/d6veteran)\
**Post date:** [April 3, 2007, 6:17pm UTC](https://www.ruby-forum.com/t/end-form-tag/90997/2 "2007-04-03T18:17:37Z")

</div>

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

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

---

<div class="post-metadata">

**Author:** ![d6veteran](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/94ad74/32.png) [@d6veteran](https://www.ruby-forum.com/u/d6veteran)\
**Post date:** [April 3, 2007, 6:21pm UTC](https://www.ruby-forum.com/t/end-form-tag/90997/3 "2007-04-03T18:21:31Z")

</div>

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 ☹

---

<div class="post-metadata">

**Author:** ![d6veteran](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/94ad74/32.png) [@d6veteran](https://www.ruby-forum.com/u/d6veteran)\
**Post date:** [April 3, 2007, 6:32pm UTC](https://www.ruby-forum.com/t/end-form-tag/90997/4 "2007-04-03T18:32:39Z")

</div>

\<% 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](http://www.loudthinking.com/arc/2006_10.html)

See also the following for examples of the syntax:

> **[ActionView::Helpers::FormTagHelper](https://api.rubyonrails.org/classes/ActionView/Helpers/FormTagHelper.html#M000601)**
>
> Provides a number of methods for creating form tags that don't rely on an Active Record object assigned to the template like FormHelper does. Instead, you provide the names and values manually.

Hope this helps.

-PJ
