Can't remove :hidden_field from input in ActiveAdmin

507 Views Asked by At

I am putting in the input of the ActiveAdmin Formtastic form an array of checkboxes (as: :checkboxes) to later use to populate a ManyToMany intermediary table that is not part of the model itself being saved on the form. But when I try to use the checkboxes, it creates automatically a hidden blank checkbox, so I can't require it to not be empty because it never is. Does anyone know of any solution? I tried hidden_fields: false and required: true but it seems to ignore both.

The code:

input :object_ids, :as => :check_boxes, :collection => Object.all, input_html: {hidden_fields: false, required: true, allow_blank: false, hint: 'Please enter an object'}

Thanks a lot for the help!

1

There are 1 best solutions below

0
strivedi183 On

I'm a little rusty on my ActiveAdmin and Formastic but I think that you could try something like below

input :object_ids, :as => :check_boxes, :collection => Object.all, include_hidden: false, include_blank: false, hint: 'Please enter an object', input_html: {required: true}