Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 780629
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T20:06:17+00:00 2026-05-14T20:06:17+00:00

I am trying to filter Client Comments by using a select and rendering it

  • 0

I am trying to filter Client Comments by using a select and rendering it in a partial. Right now the partial loads @client.comments. I have a Category model with a Categorizations join. This all works, just need to know how to get the select to call the filter action and load the partial with ajax. Thanks for you help.

Categories controller:

def filter_category
    @categories = Category.all

    respond_to do |format|
      format.js # filter.rjs
    end    
end

filter.js.erb:

page.replace_html 'client-note-inner', 
                  :partial => 'comments', 
                  :locals => { :com => Category.first.comments }

show.html.erb (clients)

<% form_tag(filter_category_path(:id), :method => :put, :class => 'categories', :remote => true, :controller => 'categoires', :action => 'filter') do %>
    <label>Categories</label>
    <%= select_tag(:category, options_for_select(Category.all.map {|category| [category.name, category.id]}, @category_id)) %>
<% end %>

<div class="client-note-inner">
    <%= render :partial => 'comments', :locals => { :com => @comments } %>
</div><!--end client-note-inner-->

Hope that makes sense.
Cheers.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T20:06:18+00:00Added an answer on May 14, 2026 at 8:06 pm

    It’s straightforward with a simple onchange

    <%= select_tag(:category, options_for_select(Category.all.map {|category| [category.name, category.id]}, @category_id), onchange => 'form.submit()') %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to filter some XML in JavaScript using E4X and have some specific
I am trying to filter a fusion table using the WHERE clause in order
I'm trying to filter a table from an alphabetical <select> input with jQuery. I
I'm trying to filter by a list of values using the criteria API. I
I'm trying to build a simple echo server/client that works on ethernet level(using raw
I'm trying to filter a list of Client entities based on properties of an
Trying to call from an android client, using the signpost oauth libs. I generated
I am trying to filter out unwanted data from an XML file. I have
Am trying to invoke a public web-service using a java client but am getting
Im trying to filter rows based on a column say c1 that contains boolean

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.