1

I would like to set up for an Active Admin form a field called field_example (string type), a basic dropdown that would show

  • option 1
  • option 2
  • option 3
  • freely inputed field

I would like to enable the user to choose of the 3 basic options but if he does not recognize himself in those 3 options, be able to type freely another string (this string would not have to be added to the list of options for future forms edition). He could type anything.

Is it possible?

My code today:

admin/model.rb

f.input :field_example,
        as:         :select,
        collection: LIST_OF_OPTIONS,
        prompt:     true

config/initializers/active_admin_constants

LIST_OF_OPTIONS = ["option1","option2", "option3"] 
Mathieu
  • 4,587
  • 11
  • 57
  • 112

1 Answers1

1

There's nothing in ActiveAdmin (Formtastic) that helps you with that, but a popular option often used with ActiveAdmin is Select2, which might help, see for example Select 2 version 4.0 allow user to enter free text

Piers C
  • 2,880
  • 1
  • 23
  • 29