# Form\_for error

**URL:** <https://www.ruby-forum.com/t/form-for-error/132090>\
**Category:** Rails\
**Created:** [March 16, 2008, 7:44pm UTC](https://www.ruby-forum.com/t/form-for-error/132090 "2008-03-16T19:44:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sjglazer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ee59a6/32.png) [@sjglazer](https://www.ruby-forum.com/u/sjglazer)\
**Post date:** [March 16, 2008, 7:44pm UTC](https://www.ruby-forum.com/t/form-for-error/132090/1 "2008-03-16T19:44:25Z")

</div>

Hi all,

I have the following code in my application layout:

 \<% if logged\_in? %\> \<%= link\_to "Sign Out", logout\_path %\> \<% else %\>

\<%= link\_to\_function “Sign in”,  
“$(‘signin’).toggle();$(‘signin\_link’).toggle()”,  
:id =\> “signin\_link” %\>

```
<%= form_tag login_path, {:id => "signin"}, {:style =>"display:

```

none"} %\>  
Log In\<%= text\_field\_tag ‘login’ %\>  
Password\<%= password\_field\_tag ‘password’ %\>  
\<%= submit\_tag ‘Sign In’ %\>

\<% end %\>  
\<% end %\>

and for some reason it complains about the \<% end %\> tag corresponding  
to the form\_tag with this message -\> syntax error, unexpected kEND,  
expecting $end

If I replace the second \<% end %\> with It works fine.

Any ideas what the heck is going on here?

Thanks,  
steve

---

<div class="post-metadata">

**Author:** ![sjglazer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ee59a6/32.png) [@sjglazer](https://www.ruby-forum.com/u/sjglazer)\
**Post date:** [March 16, 2008, 8:12pm UTC](https://www.ruby-forum.com/t/form-for-error/132090/2 "2008-03-16T20:12:45Z")

</div>

On 16 Mar 2008, at 18:44, Steve G. wrote:

> \<%= link\_to\_function “Sign in”,  
> \<% end %\>
> 
> and for some reason it complains about the \<% end %\> tag corresponding  
> to the form\_tag with this message -\> syntax error, unexpected kEND,  
> expecting $end

if you forget about all the bits in the middle you’re just doing  
form\_tag(…)  
end

Which is obviously a syntax error. On the other hand,  
form\_tag(…) do  
end

is fine.  
When using form\_tag like this you need to use \<% and not \<%=

Fred
