Hi - I have a strange thing happening in my app. I'm trying to replace a
table row with a form row using link_to_remote and form_for. In my index
view I have a call to edit:
<%= link_to_remote 'edit vendor', :url => { :action => 'edit_vendor' }
%>
This works on a partial (_vendor.html.erb):
<% @vendor = vendor %>
<tr id="vendor_<%= vendor.id %>">
<% unless edit_mode -%>
<td><%= h vendor.name %></td>
<td><%= h vendor.location %></td>
<% else -%>
<% form_for :vendor do |f| -%>
<td><%= f.text_field :name, :size => 15 %></td>
<td><%= f.text_field :location, :size => 15 %></td>
<td><%= f.submit 'save' %></td>
<% end -%>
<% end -%>
</tr>
and finally I have a js template that adds the edit row and removes the
original one
(edit_vendor.js.rjs):
page.insert_html :after, 'vendor_3',
:partial => 'vendor',
:object => Vendor.find(3), :locals => { :edit_mode =>
true }
page.remove 'vendor_3'
I just tried testing with vendor_3 to see if this works. The action
generates the form in the page source, but it isn't visible on the
actual page. I can see the form tag using firebug (it appears faded, as
though display:none -- when it's not), but for some reason which eludes
me, it's invisible in the browser:
<tr id="vendor_3">
<form method="post" action="/vendors/edit_vendor">
<div style="margin: 0pt; padding: 0pt;"/>
<input type="hidden"
value="248d3190ffb7dc764601dce231cd669054914fc5"
name="authenticity_token"/>
<td><input type="text" value="Vendor 1" size="15"
name="vendor[name]"
id="vendor_name"/></td>
<td><input type="text" value="New York" size="15"
name="vendor[location]"
id="vendor_location"/></td>
<td><input type="submit" value="save" name="commit"
id="vendor_submit"/></td>
</form>
</tr>
I checked and it doesn't have any other visibility css rules and such...
Any clues what's happening?
Attachments:
http://www.ruby-forum.com/attachment/3169/invisible.png