Response from ajax request

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’}) %>

Type a member to find: <%= text_field_tag "finduser", "", :size => 35 %> <%= 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 %>

<%= start_table :listing %>
<%= render :partial => “listing_table” %>
<%= end_table %>

here is the partial:

================================

<% if @user_is_admin %> User ID <% end %> Name Address Contacts <%= image_tag "spacer.gif", :width=> 72, :height => 1 %> <% for user in @users %> "> <% if @user_is_admin %> <%= user.login %> <% end %> <%= user.name %> <%= make_new_line user.children %>
<%= user.address %>
<% 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 %>
<% end %> <% if @user_is_admin %> <%= 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}\"?" %> <% end %> <% end %> ============================

Hi Eric,

start_table seems to be a helper of your own, right? At least I don’t
know
this helper.

Is this rendering a html-table element with the id = ‘listing’?
Doublecheck
this via page source. Then use :update => ‘listing’ on your
observe_field.
Does the problem persist?

You might as well give the rjs-templates a try right from the start.
They
are making the ajax-things a great deal easier.

Cheers,
Jan

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