Bubble_fn export variable issue - JS to Bubble Toolbox plugin

Hi everyone,

I’m using an HTML element with some javascript and I want to export a variable to Bubble in order to display it in a chart. I looked at the “JavascripttoBubble” element from the Toolbox plugin which seems to work just fine in most cases.

However, in one of my page, I’m hitting a “Uncaught ReferenceError: bubble_fn_points is not defined”, and I can’t get my head around the problem.
image


image

Javascript code purpose: load google maps and display data in it.

I tried to reproduce the error for 2 hours by adding one element at a time in a new HTML element, but no chance…
I also tried to put another HTML element in the page to set the variable like the following “bubble_fn_points(0);”… And it’s working… So maybe something is wrong with the HTML, but the code is working just fine.

I had a look at different threads in the Bubble Forum but it doesn’t solve the problem.
If someone has already faced the same weird behavior, I would appreciate any help.

Thanks
A.

Hey A, it’s probably because you forgot to enable “Trigger event” in the settings of the javbascripttobubble element.

Here an example using the javascripttobubble element to save some data:

  1. Setup a page with a button and the javascripttobubble element:

  1. A workflow triggered by the button with a Run javascript-action:

  1. A workflow triggered bij the javascripttobubble element:

Because of the code “bubble_fn_points(0);” this last workflow is triggered.

Very basic but it works, let me know if you have some questions.

Is the group that the JS to Bubble in visible?
Happy to take a look if you want to DM a link to your app and where I can find the element

Hi @gerbertdelangen ,

Thanks for your quick reply :smiley:
About the button, I was thinking about it, but the trigger of my “workflow” is a google maps listener in the javascript. I will try to link it to a button to see if it helps to make the bubble_fn_xxxx function accessible (But I’m not sure since I can access the fonction from another HTML element on the same page).

And I don’t think it’s the “Trigger event”. Already trigger this approach.

Let me do a bit more investigation / tests before posting back to the topic :slight_smile:

A.

Thanks Edward :smiley:

By trying to create a demo app to give you access, I found a “solution”…
Noticed that I couldn’t reproduce the issue in a new app. By recreating the HTML/JavascripttoBubble elements, it “magically” solved the problem.

I’m putting some screenshots if this is helpful. Seems to be a weird bug…



image

I didn’t have to create a workflow.

A.

I have the same problem. It re appears randomly. This is really concerning because many apps use this, and it seems like there is some incompatibility with the new responsive engine.

It will work for weeks at a time and then break. Then if I recreate the element and repush to live the problem goes away. This is really, really bad.


And the visibility settings are defined accordingly

Hello, up on this. I have the exact same issue. Any updates on how to solve ?

I can not read / can not reproduce the same workflow as showed at step 3 of @gerbertdelangen 's answer