Hi, newbie here.
I am trying to implement a filtering interface using observe_field.
Using firebug I can see that I am getting the properly rendered html
blob back in the response, but when it get inserted into the dom element
that I am targeting, the plain html elements from the partial template
have been stripped, leaving only the elements inserted via the <%=
statements. I would appreciate any hints.
Best,
Eric
here is the controller action that responds to the ajax request:
============================== def find_users
@user_is_admin = is_admin
@user_pages, @users = paginate :users, :order_by =>
''login'',
:per_page => 10, :conditions => "name like
''%kyle%'' or children
like ''%kyle%''"
# add error checking later
render :partial => "listing_table", :layout=>false
end
==============================
here is the containing layout showing the search field:
===============================<%= start_table %>
<%= start_form_tag(''javascript:void%200'', {:method=>
''filter''}) %>
<tr>
<th>Type a member to find:</th>
<td><%= text_field_tag "finduser", "", :size =>
35 %></p>
</tr>
<%= observe_field(:finduser,
:url => { :action => "find_users" },
:frequency => 0.5,
:update => :listing,
# :complete=>"Element.hide(''spinner'')",
# :before=>"Element.show(''spinner'')",
:with=>"''search='' +
encodeURIComponent(value)"
) %>
<%= end_form_tag %>
<%= end_table %>
<br />
<%= start_table :listing %>
<%= render :partial => "listing_table" %>
<%= end_table %>
===============================
here is the partial:
=============================== <tr>
<% if @user_is_admin %>
<th>User ID</th>
<% end %>
<th>Name</th>
<th>Address</th>
<th>Contacts</th>
<td class="clear"><%= image_tag "spacer.gif",
:width=> 72, :height =>
1 %></td>
</tr>
<%
for user in @users
%>
<tr valign="top" class="<%= cycle("alt0",
"alt1") %>">
<% if @user_is_admin %>
<td><%= user.login %></td>
<% end %>
<td>
<%= user.name %>
<%= make_new_line user.children %>
</td>
<td><pre><%= user.address %></pre></td>
<td>
<% user.contacts.each do |contact| %>
<%=contact.description %>:
<% case contact.contact_type
when CONTACT_PHONE %>
<%= fmt_phone contact.phone %>
<% when CONTACT_EMAIL %>
<%= mail_to contact.email %>
<% end %>
<br />
<% end %>
</td>
<% if @user_is_admin %>
<td class="clear">
<%= link_to image_tag("b_edit", { :style =>
''border: none'',
:title => ''Edit user'' }), { :action =>
''edit'', :id => user } %>
<%= link_to image_tag("b_secure", { :style =>
''border: none'',
:title => ''Reset password'' }), { :action =>
''resetpassword'', :id => user
}, :confirm => "Confirm changing password for user
\"#{user.login}\"?"
%>
<%= link_to image_tag("b_drop", { :style =>
''border: none'',
:title => ''Delete user'' }), {:action =>
''destroy'', :id => user},
:confirm => "Confirm deletion of user \"#{user.login}\"?"
%>
</td>
<% end %>
</tr>
<% end %>
============================