Forum Academy Marketplace Showcase Pricing Features

Toolbox plugin - collection of utility elements

Hey @mishav,

Your plugin is awesome. Im very new to programming and wanted to get some help on how to bridge the gap from calling bubble elements to edit them in the toolbox javascript action.

Im a real estate agent trying to build a real estate MLS website using a third party API called repliers.io

My hurdle relates to getting MAP the corner boundaries of a map viewport to send that data to the repliers API and receive all the listings that fit within the boundaries of the map the user is currently viewing.

I found a plugin Called leafy maps which uses leaflet to get Mapbox displayed in the plugin. I thought this plugin would fix my problems but it seems there are some functions in that plugin that are not set up by the creator yet. This function is the ability to get the MAP lat & log values for each corner.

I figured I could use toolbox to get the return values of the boundaries for the map element provided by leafy maps.

However, I am struggling trying to figure out how to call a specific element from a third party plugin using toolbox.

I did some research and thought using the function document.getelementbyid would work by setting the ID attribute in the element and calling it in the function above.

However, this threw an error and bubble could not find the variable in its database.

What functions should I be using to call an element, and how do I specify a certain part of that element (aka the mapbox call to edit to return the boundaries)?

hello, my does my html/js code keep returning “not define” for the javascript to bubble. Please help.

My JS code is coming back empty in the database, but when in the app step-by-step mode I can access the data fine?

See my post Javascript working in-app but not in database - #10 by cliffwoodjames

This is likely because the code does not run synchronously. When you run it step-by-step it operates more or less synchronously.

I see - how can I make it run synchronously? What confuses me is how certain actions work, as demonstrated in the post - this shows the long and lat from the workflow.

image

I’m having a hard time as I’m getting the following error. The code is from the ShareAsale Pixel, so I’ve just copied and pasted it. How do I find the issue?

Bug in custom code SyntaxError: Unexpected token ‘<’
at eval (PLUGIN_1488796042609x768734193128308700/Toolbox-action–Run-javascript-.js:3:51)
at root (https://smilelove.com/version-test/checkout/1665001802609x151653646700380160?debug_mode=true&?sscid=a1k6_4u6ua&:1:1)

Im getting the same exact thing while trying to set up push notifications using javascript, seems many people have had this issue with no fix.

I’m getting this same error when running a simply line of code to open a link in a new tab. I even tried Google’s link and still the same bug.

window.open(“https://www.google.com/”)

Would appreciate any help!

Hey! Try window.open(‘url’ , ‘blank’);

1 Like

Hey thanks! I had that but it wasn’t working. I deleted the workflow and recreated it and it worked like a charm. Strange but it worked. Gotta give credit to @adamhholmes in this post: Toolbox Javascript: Open Link in New Tab attaches bubble domain ahead of link URL? - #5 by sunrabuilds

I am having a problem returning the data from a fetch using the Run javascript action. I see it in the console but the JavascriptoBubble element is not seeing it. I set a variable called responeData to capture the fetch results. Here is my code after the fetch. See anything that might be causing this.

image

anyone?

try moving bubble_fn_auth up under the console line?

Also, ensure your JS-> bubble auth element has the correct data type and options checked?

thanks Troy…I checked the element and it is configured properly. I tried moving the function call up and got rid of the resultData variable. I got an error.

Here is my new code
image

Here is the error

image

I am now getting a new error saying I am trying to send an invalid array to the JavascipttoBubble element. The Value Type in the element is defined in the API Connector and I manually mapped the output by copying the format from Xano. Is there any limitation on the data types we can use with the element? Does this only work with objects in the Bubble database?

The code you’re executing there makes no sense in this context. I understand that you have no idea what you’re doing, but you’re just thrashing. If you share your entire code someone might help you. (Probably not me, but you never know.)

Also you need to share how your JStoBubble element is configured. You’re just not sharing anything helpful.

Pro tip: when dealing with code, PASTE YOUR CODE AND FORMAT IT AS CODE HERE. Who’s going to retype your junk, eh?

As @keith said, it is better to share the entire code here. Also, reading the error, it sounds like you did not declare some variable properly…

looks like Santa didnt bring @keith any people skills again for Christmas…better luck next year.

Here is my latest thrashing. Still getting the same error.

fetch(‘https://(token).n7.xano.io/api:7zRwNlws/auth/me’, {
method: ‘GET’,
headers: {
‘Authorization’: ‘Bearer (AuthCode)’
}
})
.then(response => response.json())
.then(data => {
console.log(data);
bubble_fn_auth(data);
})
.catch(error => console.error(error));

What does your response look like? I think you said you get it in the console.

Stop holding back?

1 Like

image