Form_for error

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

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs