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 8219223
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T13:04:51+00:00 2026-06-07T13:04:51+00:00

I have a feeling there is just a simple error somewhere but for the

  • 0

I have a feeling there is just a simple error somewhere but for the life of me I cannot find it. I have a filter model, and in it’s _form.html.erb there are various selects and collection selects. When the submit button is clicked I have used the debugger within the controller and found that several of the select boxes aren’t having their values being sent in the params. Here is the code with the buttons and other irrelevant things taken out:

<%= simple_form_for(@filter) do |f| %>
   <div class="inputs">
      <%= f.input :name %>
      <%= f.input :scope, :collection => ["Global", "Group", "Private"], :include_blank => false %><br>
      <p style="margin-left:190px;"><b>Users:</b></p>
      <div style="float: left; width: auto; margin-left: 190px;">
         <%= collection_select(:user, :id, User.all, :id, :full_name, {}, {:multiple => true, :size => 10}) %>
      </div>
      <%= select(:selected_users, :id, [], {}, {:size => 10, :style => "width:160px;", :multiple => true}) %>

      <p style="margin-left:190px;"><b>Positions:</b></p>
      <div style="float: left; width: auto; margin-left: 190px;">
         <%= collection_select(:position, :id, Position.all, :id, :name, {}, {:size => 10, :multiple => true}) %>
      </div>
      <div style="float: left; width: auto; margin-left: 60px; margin-top: -120px;">
         <%= collection_select(:selected_positions, :id, [], :id, :name, {}, {:size => 10, :style => "width:160px;", :multiple => true}) %>
      </div>

      <p style="margin-left:190px;"><b>States:</b></p>
      <%= select("selected_statuses", "status", ["Approved", "Pending", "Deny"], {}, {:multiple => true, :size => 3, :style => "margin-left:190px;"})%>
   </div>
<% end %>

In my params I get [:filter][:scope], [:filter][:name], [:user][:id], [:position][:id], and [:selected_statuses][:status], but none of the rest. Why is the select for the selected statuses working, while the select for the selected users isn’t? Or one of the position collection_selects but not the other? I’m very confused. And if it matters, the reason the selected_users and selected_positions are blank is because the options are added with javascript.

EDIT: After the javascript the HTML (with unnecessary bits omitted) is

<div class="inputs">
   <div class="input string optional">
      <label class="string optional" for="filter_name"> Name</label>
      <input id="filter_name" class="string optional" type="text" size="50" name="filter[name]" maxLength="255">
   </div>
   <div class="input select optional">
      <label class="select optional" for="filter_scope"> Scope</label>
      <select id="filter_scope" class="select optional" name="filter[scope]">
         <option value="Global">Global</option>
         <option value="Private">Private</option>
      </select>
   </div>
   <p style="margin-left:190px;">
      <b>Users:</b>
   </p>
   <div style="float: left; width: auto; margin-left: 190px;">
      <select id="user_id" size="10" name="user[id][]" multiple="multiple">
         <option value="2">Ethan Webworm</option>
         <option value="3">Matthew Barkbeetle</option>
         <option value="4">Sara Caterpillar</option>
         <option value="5">Olivia Daggermoth</option>
      </select>
   </div>
   <select id="selected_users_id" style="width:160px;" size="10" name="selected_users[id][]" multiple="multiple">
      <option value="2">Ethan Webworm</option>
      <option value="3">Matthew Barkbeetle</option>
      <option value="4">Sara Caterpillar</option>
   </select>

   <div style="float:left; width:auto; margin-left: 190px;>
      <select id="position_id" size="10" name="position[id][]" multiple="multiple">
         <option value="1">Manager</option>
         <option value="2">CEO</option>
         <option value="3">VP</option>
      </select>
   </div>
   <div style="float: left; width: auto; margin-left: 60px; margin-top: -120px;">
      <select id="selected_positions_id" style="width:160px;" size="10" name="selected_positions[id][]" multiple="multiple">
         <option value="1">Manager</option>
      </select>
   </div>

   <select id="selected_statuses_status" style="margin-left:190px;" size="3" name="selected_statuses[status][]" multiple="multiple">
      <option value="Approved">Approved</option>
      <option value="Pending">Pending</option>
      <option value="Deny">Deny</option>
   </select>
</div>
  • 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-06-07T13:04:53+00:00Added an answer on June 7, 2026 at 1:04 pm

    I just found the solution, which was indeed a simple embarrassing mistake… The reason the selected users/positions weren’t being sent in the parameters was just that while the options were added to the box in javascript they weren’t actually selected. Now I just need to find a way to select all of the options before sending the form. Thanks for the help!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a feeling that this question is very simple, but I just can't
I have a feeling there is a simple/built-in way to do this but I
I have a feeling there is a simple answer to this, but I am
I have a feeling this is a stupid question but I can't find the
I have a feeling that this is a subjective question, but perhaps there's something
I have a feeling that there must be client-server synchronization patterns out there. But
I have the feeling this has a really simple solution and I'm just suffering
I have a feeling I'm going about this all wrong. But anyway. I have
I have the feeling the answer to this question is no but I figured
I have a feeling that this query is pretty easy to construct, I just

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.