I needed to have an input for array of strings. Figured the simplest way to do it for now is to have textarea
where each entry is a separate line.
In order to update the field with one more entry you need to add new line to textarea, for example if a model has 3 values in array: value1, value2, value3, the rendered textarea will have the following value:
value1
value2
value3
To add / remove / change entries you just change appropriate lines.
In order for this to work, the corresponding model is responsible of casting fields of type {:array, :string} from string to array in it's changeset/2 function.
I needed to have an input for array of strings. Figured the simplest way to do it for now is to have textarea where each entry is a separate line.
In order to update the field with one more entry you need to add new line to textarea, for example if a model has 3 values in array: value1, value2, value3, the rendered textarea will have the following value:
value1 value2 value3
To add / remove / change entries you just change appropriate lines.
In order for this to work, the corresponding model is responsible of casting fields of type {:array, :string} from string to array in it's changeset/2 function.