# JS2Bubble List Parameter

**URL:** <https://forum.bubble.io/t/js2bubble-list-parameter/321954>\
**Category:** Need help\
**Created:** [May 12, 2024, 1:26am UTC](https://forum.bubble.io/t/js2bubble-list-parameter/321954 "2024-05-12T01:26:28Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![ken1](https://avatars.discourse-cdn.com/v4/letter/k/4491bb/32.png) [@ken1](https://forum.bubble.io/u/ken1)\
**Post date:** [May 12, 2024, 1:26am UTC](https://forum.bubble.io/t/js2bubble-list-parameter/321954/1 "2024-05-12T01:26:28Z")

</div>

Hi all! I am using the Javascript 2 Bubble from the Toolbox plugin. I use this a lot and have no problem sending one or more parameters to the event and using it in Bubble.

But today I’m having a problem when trying to send a parameter that is a list. This is the first time I’ve needed to send a list this way. I cannot figure out what is wrong here. I appreciate any help you can provide.

The objective is to trigger an event from inside a reusable element that will use a list value from the reusable to populate a state on the main page (I can’t do that directly because of scope — I can’t see the page from the reusable element).

Here is my setup:

The element on my page. I am sending a list of type _Context_:

 ![Screenshot 2024-05-11 at 9.15.46 PM](https://us1.discourse-cdn.com/bubble/original/3X/d/6/d689e3aea40b0834aea92bc0e9e8726f7ed878be.png)

This is the Action inside of my reusable element. The multidropdown is of type _Context_:

 ![Screenshot 2024-05-11 at 9.14.13 PM](https://us1.discourse-cdn.com/bubble/original/3X/5/d/5d0e0ff67170916662f8d10602af0eed38da6051.png)

This is what I get after running the script. Notice that _outputlist1_ is empty instead of containing the list (which did have values).  
 ![Screenshot 2024-05-11 at 9.17.02 PM](https://us1.discourse-cdn.com/bubble/original/3X/f/a/fa58b6325d852cc2620ad1655cfee4c03f3bea00.png)

And this is the Action that fails because the value is empty instead of containing the list (I don’t know if you really need to see this, but I’m including it for completeness):  
 ![Screenshot 2024-05-11 at 9.15.08 PM](https://us1.discourse-cdn.com/bubble/original/3X/a/0/a0def7d9f86ff2e48e95bfe75685f0c60c386f58.png)

Thank you!

---

<div class="post-metadata">

**Author:** ![samuel98](https://avatars.discourse-cdn.com/v4/letter/s/9e8a1a/32.png) [@samuel98](https://forum.bubble.io/u/samuel98)\
**Post date:** [May 12, 2024, 5:19pm UTC](https://forum.bubble.io/t/js2bubble-list-parameter/321954/2 "2024-05-12T17:19:38Z")

</div>

Can’t help but notice that you’re using the outputlist1 but haven’t checked the Multiple Outputs checkbox.

When working with JS2Bubble if you’re not going to use the multiple outputs: just select value is a list and pass the list directly into the bubble\_fn\_suffix([list]) function. If want to keep using Multiple Outputs(output1…4, outputlist1…4) just check the checkbox.

---

<div class="post-metadata">

**Author:** ![ken1](https://avatars.discourse-cdn.com/v4/letter/k/4491bb/32.png) [@ken1](https://forum.bubble.io/u/ken1)\
**Post date:** [May 12, 2024, 10:30pm UTC](https://forum.bubble.io/t/js2bubble-list-parameter/321954/3 "2024-05-12T22:30:02Z")

</div>

Thanks for your reply. You’re right that I missed the Multiple Outputs checkbox. But actually it was checked at first, but ended up unchecked as I was troubleshooting. The result was the same. That list parameter is still empty.

In fact, I’ve been using the multiple output for all of my parameters (for single values, not lists) mostly because I cannot figure out how to use the passed value. If you have an example of this it will be appreciated.

It might also be something in my Javascript, because I often (but not always) get an error. This is the error with the above configuration:

 ![Screenshot 2024-05-12 at 6.29.27 PM](https://us1.discourse-cdn.com/bubble/original/3X/b/0/b07983958cf0f01f1a115ebff5f7a691fe59505a.png)

---

<div class="post-metadata">

**Author:** ![samuel98](https://avatars.discourse-cdn.com/v4/letter/s/9e8a1a/32.png) [@samuel98](https://forum.bubble.io/u/samuel98)\
**Post date:** [May 13, 2024, 1:27am UTC](https://forum.bubble.io/t/js2bubble-list-parameter/321954/4 "2024-05-13T01:27:44Z")

</div>

So, I don’t know if there’s something missing on your part but I will leave an example on how I use the lists on JStoBubble, both ways, using Multiple Outputs and as a single List.

The elements:

 ![listoutput](https://us1.discourse-cdn.com/bubble/original/3X/8/4/8417884ae9b7f250731361205ac1d42f06ab156e.jpeg)

The run js assigning the values:

 ![brave_aRbYUQwD88](https://us1.discourse-cdn.com/bubble/original/3X/1/1/11cd3cb92d37d910f046660235ae8f627aa544cb.png)

Display:

 ![brave_9kdtwYGsyU](https://us1.discourse-cdn.com/bubble/original/3X/b/a/baca5627f7a336310e94f7311986d1f4895a897e.png)

If you want to debug your specific problem, remember you can use console.log to check what is coming as your “properties.paramlist1” value.

---

<div class="post-metadata">

**Author:** ![ken1](https://avatars.discourse-cdn.com/v4/letter/k/4491bb/32.png) [@ken1](https://forum.bubble.io/u/ken1)\
**Post date:** [May 13, 2024, 3:38pm UTC](https://forum.bubble.io/t/js2bubble-list-parameter/321954/5 "2024-05-13T15:38:17Z")

</div>

Thank you for the examples. I was using the paramlist1 box to enter my values but I tried it your way as well. I got the same result. That at least tells me that maybe I am not necessarily getting it wrong.

I think the key is the error that often appears (posted above) which states “Trying to send an invalid array to Bubble”

Is there something about using a custom data type that’s a problem? I’m trying to send the value of a multidropdown which contains 0 or more of this custom data type. When I tried using your method and in the JS I added

`let contexts = This Multidropdown's value`

it was red to indicate an error. It wasn’t until I added `:each item's uniqueID` it would accept it. But this still did not solve the problem.

So is there something about the custom data type, or maybe the value of a Multidropdown that is a problem?

Thanks.

---

<div class="post-metadata">

**Author:** ![samuel98](https://avatars.discourse-cdn.com/v4/letter/s/9e8a1a/32.png) [@samuel98](https://forum.bubble.io/u/samuel98)\
**Post date:** [May 13, 2024, 4:13pm UTC](https://forum.bubble.io/t/js2bubble-list-parameter/321954/6 "2024-05-13T16:13:48Z")

</div>

When using a custom data type, you have to specify that on the JS2Bubble element, also, check what is the content of the “This Multidropdown’s value”. I don’t really know in your specific case but remember that when using Bubble Data Types you should know how to use them:  
[https://toolboxdocs.netlify.app/run-js#bubble-type-param](https://toolboxdocs.netlify.app/run-js#bubble-type-param)

Using bubble datatype instead of list of text:

 ![brave_eIALI9ipHT](https://us1.discourse-cdn.com/bubble/original/3X/f/f/ff484992feca264aa2ada7efcda63c31cccf6a29.png)  
 ![brave_6cpO0DyU9f](https://us1.discourse-cdn.com/bubble/original/3X/4/1/41d4300b6a20fc994261f2a30a517b347f56c138.png)  
 ![brave_lPdSN0rShn](https://us1.discourse-cdn.com/bubble/original/3X/8/7/87bb45a47820381d1f030e306a66ba77c38e5d68.png)

---

<div class="post-metadata">

**Author:** ![ken1](https://avatars.discourse-cdn.com/v4/letter/k/4491bb/32.png) [@ken1](https://forum.bubble.io/u/ken1)\
**Post date:** [May 13, 2024, 4:28pm UTC](https://forum.bubble.io/t/js2bubble-list-parameter/321954/7 "2024-05-13T16:28:40Z")

</div>

Sure, I’ve specified type Context which you can see in a screenshot in the original post. Also, I’ve verified that my Multidropdown’s value evaluates to a list of Contexts, so I cannot figure out what is happening. I can’t say for sure, but it feels like a bug in the plugin to me. Of course, I’m open to trying anything to make it work.

Thanks again for your help.

---

<div class="post-metadata">

**Author:** ![samuel98](https://avatars.discourse-cdn.com/v4/letter/s/9e8a1a/32.png) [@samuel98](https://forum.bubble.io/u/samuel98)\
**Post date:** [May 13, 2024, 4:43pm UTC](https://forum.bubble.io/t/js2bubble-list-parameter/321954/8 "2024-05-13T16:43:21Z")

</div>

Check the code I used to load the list from a bubble data type(RUN JS):  
 ![image](https://us1.discourse-cdn.com/bubble/original/3X/0/1/013fc85cdda1cda0389f21dec14252cd7a5be997.png)  
You’re using properties.paramlist1 as is. If that don’t work, feel free to setup a similar example on a new bubble page and invite me to collaborate, I’ll check it out when I’m free.

---

<div class="post-metadata">

**Author:** ![ken1](https://avatars.discourse-cdn.com/v4/letter/k/4491bb/32.png) [@ken1](https://forum.bubble.io/u/ken1)\
**Post date:** [May 13, 2024, 5:26pm UTC](https://forum.bubble.io/t/js2bubble-list-parameter/321954/9 "2024-05-13T17:26:01Z")

</div>

I did follow that code and instead of the properties.paramlist1 method, I cleared that and used dynamic input in my JS code to include my Multidropdown’s value where you have the variable assignment. This is what I was trying to describe where it was red (error) until I added `:each item's uniqueID` at which time it turned blue. It’s as if it did not accept the data type.

Of course this script is not in the same place where the data type is defined in the JS2Bubble element, so I don’t know what the issue is.

I’m on a Personal account and cannot invite users, but I’ll set up a new free example with the same steps and open the access. Thank you for offering to look at it.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/bubble/original/3X/2/8/2847faa74692c2ffa5d939d3dc3724cdd060d247.png) [@system](https://forum.bubble.io/u/system)\
**Post date:** [July 21, 2024, 1:26am UTC](https://forum.bubble.io/t/js2bubble-list-parameter/321954/10 "2024-07-21T01:26:34Z")

</div>

Closed on July 21, 2024, 1:26am UTC

This topic was automatically closed after 70 days. New replies are no longer allowed.
