Hi! I''m using Pat Shaughnessy''s auto_complete fork, working
with nested
forms. It''s working very well, producing the right auto complete query
and filling up the auto-complete div (as I can see from firebug). Just,
the div has a style="display: none;" property always set
that''s
preventing it from showing up!
Here is my code:
# app/views/letters/_form.html.erb
<% form_for(@letter, :html => {:multipart => true}) do |letter_form|
%>
[...]
<div id="entities">
<% @letter.entities.build unless @letter.entities %>
<% letter_form.fields_for :entities do |entity_form| %>
<%= render :partial => "entity", :locals => {:f =>
entity_form} %>
<% end %>
<%= link_to ''Aggiungi'', ''#entity'',
:class => "add_nested_item", :rel
=> "entities" %>
</div>
[...]
<% end %>
# app/views/letters/_entity.html.erb
<div class="entity">
<%= f.text_field_with_auto_complete :name, {:size => 35}, {:method =>
:get, :skip_style => true} %>
<%= remove_link_unless_new_record(f) %>
</div>
This is the generated HTML code after I type a few letters:
<div id="entities">
<a class="add_nested_item" rel="entities"
href="#entity">Aggiungi</a>
<div class="entity">
<style type="text/css">
</style>
<input id="entity_20338460_name" type="text"
size="35"
name="letter[entities_attributes][1248861894018][name]"
autocomplete="off"/>
<div id="entity_20338460_name_auto_complete"
class="auto_complete"
style="display: none;">
<ul>
<li>Joseph Ratzinger</li>
</ul>
</div>
<a class="remove" href="#entity">Rimuovi</a>
</div>
</div>
Any suggestion on why the div is not showing up? I tried searching on
the net but could not find anything useful. Thanks!
--
Posted via http://www.ruby-forum.com/.