# Bubble\_fn not setting JS to Bubble element value in Toolbox plugin

**URL:** <https://forum.bubble.io/t/bubble-fn-not-setting-js-to-bubble-element-value-in-toolbox-plugin/93944>\
**Category:** Plugins\
**Created:** [May 26, 2020, 7:47pm UTC](https://forum.bubble.io/t/bubble-fn-not-setting-js-to-bubble-element-value-in-toolbox-plugin/93944 "2020-05-26T19:47:13Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![mghatiya](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/mghatiya/32/162800_2.png) [@mghatiya](https://forum.bubble.io/u/mghatiya)\
**Post date:** [May 26, 2020, 7:47pm UTC](https://forum.bubble.io/t/bubble-fn-not-setting-js-to-bubble-element-value-in-toolbox-plugin/93944/1 "2020-05-26T19:47:13Z")

</div>

Hi,

I am using “JS to Bubble” element of Toolbox plugin, but unfortunately the value is not getting set into it.

This is how elements are set up:

 ![Screenshot 2020-05-27 at 12.31.56 AM](https://us1.discourse-cdn.com/bubble/original/3X/b/f/bfdb5c60e57d55e63108d2855f5e98a28749c6b8.png) ![Screenshot 2020-05-27 at 12.31.46 AM](https://us1.discourse-cdn.com/bubble/original/3X/0/2/02eba00b1924f035a7ec436aa5fef98e7569d1b6.png)

This is my javascript code:  
 ![Screenshot 2020-05-27 at 12.31.28 AM](https://us1.discourse-cdn.com/bubble/original/3X/5/b/5b05e0c3eac233e4d8249d73df614540ad5e79e0.png)

This is what I see in console:  
 ![Screenshot 2020-05-27 at 12.31.13 AM](https://us1.discourse-cdn.com/bubble/original/3X/9/7/97f8371113af1f2e05f0e13ee5a5c6cb6ba41500.png)

What am I doing wrong?

Funnily, there is another “JS to bubble” element in the same page, which is working. I tried to check every character by character as to what is different, I am unable to see the issue.

Please help.

Thanks,  
Mukesh

---

<div class="post-metadata">

**Author:** ![mghatiya](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/mghatiya/32/162800_2.png) [@mghatiya](https://forum.bubble.io/u/mghatiya)\
**Post date:** [May 27, 2020, 5:43am UTC](https://forum.bubble.io/t/bubble-fn-not-setting-js-to-bubble-element-value-in-toolbox-plugin/93944/2 "2020-05-27T05:43:45Z")

</div>

I am able to reproduce this issue in a separate independent page. I think its a bug.

You can test the issue on this link: [Beegle](https://beegle.app/js_test2)

Basically, when you press the button, it assigns a value to one of the “JS to Bubble” element. Then I try to retrieve value in the workflow and it shows that as empty when I put in a condition “Is empty”. But when I use it as a dynamic expression “Element’s value”, then the value gets assigned to the elements correctly.

Also, I am not able to read the value in Javascript too. When I print the value in JS console, I get empty value like this:

 ![Screenshot 2020-05-27 at 11.12.18 AM](https://us1.discourse-cdn.com/bubble/original/3X/1/4/14eacfd22e43baf77e2976a4f0248f94da1ac8a2.png)

What is going on?

Here are the set up details:

 ![Screenshot 2020-05-27 at 11.07.18 AM](https://us1.discourse-cdn.com/bubble/original/3X/9/b/9bbc2038cac15284765075115160e2ae476da78a.png)

 ![Screenshot 2020-05-27 at 11.06.37 AM](https://us1.discourse-cdn.com/bubble/original/3X/2/c/2c8124ccf3eb9df628dca175fae5503dc54fe87a.png)

![Screenshot 2020-05-27 at 11.06.57 AM](https://us1.discourse-cdn.com/bubble/original/3X/5/6/569c9b4a565f0969baea61896ca7ba4c149bed19.png)

![Screenshot 2020-05-27 at 11.06.49 AM](https://us1.discourse-cdn.com/bubble/original/3X/c/f/cfd82a9c6a446c7580c039f344b0d08d5fb45785.png)

@mishav this may need your attention as it clearly looks like a bug to me.

Thanks,  
Mukesh

---

<div class="post-metadata">

**Author:** ![exception-rambler](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/exception-rambler/32/152704_2.png) [@exception-rambler](https://forum.bubble.io/u/exception-rambler)\
**Post date:** [May 29, 2020, 4:31pm UTC](https://forum.bubble.io/t/bubble-fn-not-setting-js-to-bubble-element-value-in-toolbox-plugin/93944/3 "2020-05-29T16:31:27Z")

</div>

Your issue is that you are putting putting the output value in quotation marks so:

`console.log('Test content: '+'JS2BTest's value');`  
should be  
`console.log('Test content: '+JS2BTest's value);`

---

<div class="post-metadata">

**Author:** ![mghatiya](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/mghatiya/32/162800_2.png) [@mghatiya](https://forum.bubble.io/u/mghatiya)\
**Post date:** [May 29, 2020, 4:43pm UTC](https://forum.bubble.io/t/bubble-fn-not-setting-js-to-bubble-element-value-in-toolbox-plugin/93944/4 "2020-05-29T16:43:30Z")

</div>

No Edward, that’s not the case. This is how “Run Javascript” works. I had tried putting it without quotes earlier and had got syntax errors.

I am very confident of this as I am using JS to Bubble at another place where it works, and I am using the console log bit exactly same way.

Also, the issue is not just in printing of the value. As you can see in my second example, Bubble is finding the value of JS To Bubble element to be empty. I have even given an example URL where you can try what I have built.

---

<div class="post-metadata">

**Author:** ![mghatiya](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/mghatiya/32/162800_2.png) [@mghatiya](https://forum.bubble.io/u/mghatiya)\
**Post date:** [June 8, 2020, 5:18pm UTC](https://forum.bubble.io/t/bubble-fn-not-setting-js-to-bubble-element-value-in-toolbox-plugin/93944/5 "2020-06-08T17:18:13Z")

</div>

I am surprised no one else is facing this issue. I am facing it again and again.

Is there some caching that JS to Bubble element needs to clear or some such thing?

---

<div class="post-metadata">

**Author:** ![dan8](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/dan8/32/33110_2.png) [@dan8](https://forum.bubble.io/u/dan8)\
**Post date:** [July 31, 2020, 6:28am UTC](https://forum.bubble.io/t/bubble-fn-not-setting-js-to-bubble-element-value-in-toolbox-plugin/93944/6 "2020-07-31T06:28:18Z")

</div>

I have experienced this issue.

I have setup the correct workflow to pull in the value (let’s face it, it’s not hard. Set a variable and then assign it to your bubble variable).

It’s console logging perfectly when I output bubble\_fn\_bla but then when I have a workflow to create a thing, it’s empty.

I checked it’s a string (not object). It displays fronted fine in a text box.

As it’s a workflow, I did the usual check on possible bumps (privacy, data type). No bueno.

I contacted bubble support a few months back with a similar issue but as there is a plugin involved, it’s not their remit. (The great toolbox).

I find it’s usually easier to look for a workaround than to try and solve the black box issue.

---

<div class="post-metadata">

**Author:** ![mghatiya](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/mghatiya/32/162800_2.png) [@mghatiya](https://forum.bubble.io/u/mghatiya)\
**Post date:** [August 1, 2020, 8:33am UTC](https://forum.bubble.io/t/bubble-fn-not-setting-js-to-bubble-element-value-in-toolbox-plugin/93944/7 "2020-08-01T08:33:16Z")

</div>

Thanks for sharing this, Dan. Yes, it is an issue.

As you mentioned, I also managed to do what I wanted to do with some workaround which was not quite complete, but okay for my use-case.

---

<div class="post-metadata">

**Author:** ![daniel24](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/daniel24/32/86418_2.png) [@daniel24](https://forum.bubble.io/u/daniel24)\
**Post date:** [February 27, 2021, 6:09pm UTC](https://forum.bubble.io/t/bubble-fn-not-setting-js-to-bubble-element-value-in-toolbox-plugin/93944/8 "2021-02-27T18:09:47Z")

</div>

@mghatiya was this issue ever resolved. I’m facing this as well. What work around did you come up with?

---

<div class="post-metadata">

**Author:** ![daniel24](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/daniel24/32/86418_2.png) [@daniel24](https://forum.bubble.io/u/daniel24)\
**Post date:** [February 27, 2021, 11:32pm UTC](https://forum.bubble.io/t/bubble-fn-not-setting-js-to-bubble-element-value-in-toolbox-plugin/93944/9 "2021-02-27T23:32:23Z")

</div>

I was able to solve this with help from mishav

JStoBubble element: turn on “Trigger event”

Workflows:

Button click event → Javascript calls bubble\_fn\_myvalue(value)

JStoBubble A’s event → JStoBubble A’s value should now be available

---

<div class="post-metadata">

**Author:** ![mghatiya](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/mghatiya/32/162800_2.png) [@mghatiya](https://forum.bubble.io/u/mghatiya)\
**Post date:** [February 28, 2021, 3:19am UTC](https://forum.bubble.io/t/bubble-fn-not-setting-js-to-bubble-element-value-in-toolbox-plugin/93944/10 "2021-02-28T03:19:10Z")

</div>

Thanks Daniel for sharing the answer. Great to hear.

Actually I had thought that I had found a workaround, but later realised that it didn’t work. Then I just gave up on using JStoBubble altogether and also on my use-case.

Will try your solution when I get to it next.

---

<div class="post-metadata">

**Author:** ![nick.tomic](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/nick.tomic/32/124877_2.png) [@nick.tomic](https://forum.bubble.io/u/nick.tomic)\
**Post date:** [July 10, 2023, 6:32pm UTC](https://forum.bubble.io/t/bubble-fn-not-setting-js-to-bubble-element-value-in-toolbox-plugin/93944/12 "2023-07-10T18:32:15Z")

</div>

Hey Daniel! Do you mind sharing the workflow steps (as screenshots) for this?

---

<div class="post-metadata">

**Author:** ![mishav](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/mishav/32/6420_2.png) [@mishav](https://forum.bubble.io/u/mishav)\
**Post date:** [July 11, 2023, 3:07am UTC](https://forum.bubble.io/t/bubble-fn-not-setting-js-to-bubble-element-value-in-toolbox-plugin/93944/13 "2023-07-11T03:07:47Z")

</div>

@nick.tomic there is a partial example here: [bubble editor](https://bubble.io/page?type=page&name=js-to-bubble&id=toolbox-example&tab=tabs-2)

Workflow causing the change:

![image](https://us1.discourse-cdn.com/bubble/original/3X/c/6/c6dea35441d4bc2264de81af121477a74787cae1.png)

Workflow where updated value is available :

![image](https://us1.discourse-cdn.com/bubble/original/3X/1/3/136d762bef0d3d64615c940136eb85ac5b84f972.png)

This example is intended to highlight the event trigger, so doesn’t demonstrate the use of the updated value.
