Humayun Naseer
Humayun Naseer

Reputation: 460

How to send multiple tags as an array in a single text_field

I have a column of tags[] type array and for now, I'm sending multiple values of the array by

<div class="field">
    <%= form.label :tags %>
    <%= form.text_field :tags, name: "vacancy[tags][]" %>
    <%= form.text_field :tags, name: "vacancy[tags][]" %>
    <%= form.text_field :tags, name: "vacancy[tags][]" %>
  </div>

but I don't want to use multiple text_fields for multiple array values is there any way to send multiple array values in just one text_field?

Upvotes: 0

Views: 290

Answers (1)

Mahys116
Mahys116

Reputation: 538

I think you should look at multiselect input with dynamic creation options like select2: https://select2.org/tagging#tagging-with-multi-value-select-boxes

Upvotes: 2

Related Questions