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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:46:52+00:00 2026-06-08T18:46:52+00:00

I am setting up a formtastic form where a number of fields need to

  • 0

I am setting up a formtastic form where a number of fields need to have the option to “select all that apply”. (FYI I use slim but i can convert this back to normal rails if necessary).

For example. I define this input:

    = f.input :categories_list, :label => _("Commonly Found In"), :as => :check_boxes, :multiple => true, :collection => Category.all

This creates a bunch of checkboxes, and only ones that exist appear. BUT when I select one (or two or three) it breaks the creation of the model that I am creating, and I noticed that the categories_list field is submitted as:

  "categories_list"=>["", "1", "2"],

Instead of as:

  "categories_list"=>["1", "2"],

Does anyone know why this is? Is this a bug with formtastic? Please let me know if I should post any more relevant code. I would really like to know how to make this work.

  • 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-08T18:46:55+00:00Added an answer on June 8, 2026 at 6:46 pm

    This is to allow clearing of all selections. Without the blank/empty value at the start of the array, the browser would not set the categories_list param at all, and the existing checkboxes would remain checked.

    With categories_list not set, you’d have no idea what the user intended.

    You simply need to filter this blank option out of the params either in the controller or your model if it’s not working for you (but I’d recommend you try to replicate the issue on editing before dismissing it).

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

Sidebar

Related Questions

Setting up the sandboxes for all these option is not feasible right now. So
Setting up CI within Microsoft Team Foundation Server, I have a build that will
Setting: Java 5 - no upgrade possible. I have a large application that has
Setting up a custom form. Magento doesn't use the 'value' attribute of addField. Suggestions?
Setting up the multi language site I now need to decide which option I
setting is the following: I have a homepage where I display a diagram that
I have a formtastic form like the following: = semantic_form_for @record, :remote => true,
On form 1, I have a formtastic date_select field. = f.input :date_from, :discard_day =>
I have a simple Formtastic form with nested model as follow. <%= semantic_form_for @event
Setting up a project structure; I am thinking is it better to have somewhat

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.