Jump to content
  • 0

Populate multi select dropdown with values saved in a text field


JKSGT

Question

Hi,

 

I wonder if someone would have a bit of JS to help populate a multi select dropdown with values which are saved in a table as text field as text separated by commas?

The page I am using is a Submission Form and I am effectively trying to copy a record. In the Submission Form I can populate all the fields with the previously saved values in the table but the multi select dropdown is defeating me. I have managed to set up a text field and save the user's previous selection in the multi select dropdown in this text field as text separated by commas. Now  I need to get this text back into the multi select dropdown so that the user doesn't have to make a new selection. 

Many thanks

Jay

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

HI @JKSGT- in order for you to have values inside your multi-select dropdown is to first create a field that has a List-String DataType, in there you can add values of your choice. Then, upon configuring into your submission form, select the field and you have the choice to Display only or have a multi-select dropdown/listbox. I tried this on my end with my previous work. I would like to provide you this helpful documentation from Caspio as well: https://howto.caspio.com/tables-and-views/data-types/list/ and a forum post that you can refer to: I hope this helps :) cheers!

image.png.963a59a7b7208aa9f1cf0894b63da2c8.pngimage.png.ca3ac0502a7b6c2134968a91ed33d558.pngimage.png.9f4b41c1b056bf7b8e57d061f035262b.pngimage.png.391d02b763b9f1e82c56fbb7e9841890.png

image.png

Link to comment
Share on other sites

  • 0

This is actually kinda tricky. Probably because I suck at javascript. But, if you're any better than I am, I think you'll be able to get it. 

Check out this SO post, I think you'll want most of the function that the answer provides. This solution adds options to the select statement, but it also shows you how to get the values from the comma separated values in the text field. (advise that this workflow does not take into account spaces in the text field when splitting the comma separated values)

Then, maybe something like this SO post to help you select the correct options. 

I am not fluent enough in JS to be able to put all of this together, but I hope this gets you started on the right path. Maybe someone more proficient will chime in to help you piece this together. 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...