user added select values

user added select values

loukinglouking Posts: 264Questions: 54Answers: 0

Description of problem:

I intend to have an editor field where the user can add email addresses. These will not be stored in a separate table from which the options can be retrieved. These will be stored the table I'm editing which will store these as a@example.com;b@example.com. I initially tried doing this with select2 using its tags feature, but the data which is already in the table isn't shown when I bring up the editor modal. (The table already has single email addresses as text fields, but I want to add the feature allowing the user to add or create multiple addresses)

I want to create a link to a test case, but first I want to verify that select2 is an ok way to do this. Most of the selects in my application are select2.

I looked briefly at the tags data type, but I don't think this works for my use case.

Assuming select2 is fine, where is the best place to find a live version I can clone to show my problem?

Answers

  • allanallan Posts: 65,670Questions: 1Answers: 10,922 Site admin

    The Select2 plugin for Editor has a separator option that might be useful here. If you have a string which has multiple values delimited by a specific character, use that option to have it split the string up into the individual parts.

    Here is a Select2 example in Editor that you could use as your base.

    Do you need the Select2 lookup feature here (since you aren't storing it, there is nothing to lookup)? Or is it just a way to combine multiple values into a single string?

    Allan

  • loukinglouking Posts: 264Questions: 54Answers: 0
    edited 8:36AM

    Just looking for a way to combine multiple values into a single string, and edit them if they change. I am using the separator option. The issue I'm seeing is the value already in the database isn't displayed. I'll work up a test case hopefully some time today.

  • loukinglouking Posts: 264Questions: 54Answers: 0
    edited 8:49AM

    sorry, before I made any changes with the example, I wasn't seeing the edit buttons, and when I Run with JS I got Script error (line 0). Adding select2 to the html didn't help. https://live.datatables.net/devokawi/4/edit

Sign In or Register to comment.