>
> <%= form.input :first_name%>
> <%= form.input :last_name%>
>
> <%= link_to_function "clear", :id => ,
"this.up(''li'').remove()" %>
>
> This works fine but the link is located outside of the <li> tag which
> causes the formatting to be weired. How can I generate this link and
> position it within the <li> tag it is supposed to remove? I think the
> answer might be very simple, i am just not clear about how to move an
> elements while creating it.
I would recommend you do it either as:
<%= form.input :last_name, :links => [{:name => "clear",
:function =>
"this.up(''li'').remove()"}] %>
or:
<% form.input :last_name do %>
<%= link_to_function "clear", :id => ,
"this.up(''li'').remove()" %>
<% end %>
Either way you''re going to have to amend your custom form builder.
Your
form builder is already outputting the <li>. If you''re doing it
the second
way (which I''d recommend as it''s more flexible) remember you
can''t have <%with do/end so you have to use concat to output the
content if block_given?
(within your input method).
Alternatively, you could do it with jQuery or something similar - give the
link a class and then have a DOM ready event move any items with that class
within the previous sibling.
Cheers,
Andy
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.