Forum Documentation Showcase Pricing Learn more

Toolbox plugin - collection of utility elements

#163

Hey @zelus_pudding,

My guess is the element you are referencing is not in the dom when the expression evaluates. Try setting the expression element to not be visible on page load, and then have a workflow event of When page is loaded > show expression.



Looking to accelerate your app development?

Let me turn
:thinking: :tired_face: :confounded:

into
:grinning: :sunglasses: :woman_student:

Development through Coaching at https://uniqueideas.com or schedule a free intro session :gift:

Ken Truesdale
LinkedIn

1 Like
#164

That seems to have been the case :slight_smile: Thank you! Although, I would’ve thought that this function would re-evaluate every time the dropdown changes values but it doesn’t :confused: Any idea how to get it update with changed values?

#165

I figured it out… without actually referencing the drop down the expression wouldn’t reevaluate every time the dropdown changed. So I made a dummy function that took the dropdown as a dynamic input and then generated the index by direct attribute selection.

function get_index_of_dropdown(dropdown_value) {
    return document.getElementById("kitchen_oioio").selectedIndex;
}

get_index_of_dropdown("Dropdown Test Time 's value");

See:
image

Feelin’ good!

2 Likes
How to get index of selected value from dropdown?
#166

Any constraints in an iframe to use javascript to bubble ?

It works with basic example but when implemented inside a more complex iframe, I got error
bubble_fn_1 is not defined

My goal is to implement VGG annotator, a great tool to annotate images. I customized their code to

  • upload automatically images from a list provided by Bubble ( ok, works)
  • get the result (some text data giving x and y coordinates) into a Bubble’s input : does not work :thinking:

See below :


and

any thoughts ? thanks !

#167

Hi @mishav

Is Crypto / AES256 available in toolbox’s server script? Or is this a bubble limitation. I’ve run the following static encryption script, but receiving errors. Just trying to trouble shoot:

@boostsalesgroup Also tried something a similar script with HMAC with require(‘crypto’)

Thank you -

#168

Hey @mishav, et al,

Interesting behavior here, where I set a db value using javascript to bubble element, it fails on the first attempt, and works on all future attempts. I’ve stripped it down to the following basic test:

Gives me:
1rst Click:

2nd Click:

Notice that the amount_number is only showing on the 2nd hit.

If I simply set a value instead of using the javascript to bubble element, it all works fine.

Am I just being a knuckle head and doing something wrong?

Appreciate any help here!

#169

@gilles, I don’t believe you can require NPM modules in Server Script. There’s no bundler/install type feature there. But you can just do this as a server side action plugin.

Setup is roughly the same, but there’s a magic field where you can specify your dependencies.

1 Like
#170

Thanks Keith - will check the threads relating.

#171

It’s real easy. Though note: SSAs are slow AF at the moment. (The same behavior is exhibited by server script so this shouldn’t surprise, but FYI.)

1 Like
#172

Crypto is available, but you need to load it using

var crypto = require('crypto');

2 Likes
#173

I’m trying to use server scripts exclusively as state for API workflows, like a variable. Even my most basic example causes an error.

Here is the workflow, after which I do a “Return Data from API” although even without that return workflow it will throw the error.

In Postman, this is returned:

“message”: “Unexpected server error, please try again later”

When I go into the server logs, there are two sequential errors:

Workflow error - ret_val.custom_type is not a function

ret_val.custom_type is not a function

Am I doing something wrong?

#174

I’m guessing data should be “text”, since you want to return a string.

#175

@miguel The return type is text, isn’t the data field for the text itself?

#176

What I mean is that the text test might need to be double-quoted (or single-quoted), since what you want to return is a string.

But I have not tried it.

#177

I see. I gave that a try just now, it did not work either.

#178

Hi @mishav. Hope you can help me.

I’m trying to send a stringified json result from an external Bubble APP Data API call to a RG. For this I’m using the JS to Bubble and Expression elements.

However when I do so it seems that the JS2Bubble element is adding commas and creating an array with all the chars in the stringified JSON.

image

Apiyo - Callie sends a json formatted as text.

Any tip or hint would be most appreciated :slight_smile:

Edit: I managed to move forward with

image

But now I’m getting errors per each item in the list.

2nd Edit: Error fixed. Peachy!

#179

I’m manually coding user data and trying to automate some of the most error prone parts. So I’ve got strings like “2019-03-11T0745” describing date and maybe time of data points.

Is it possible to use the expression widget to parse these strings into bubble datetime things?

I tried using “new Date(input A’s value)” like in this thread but even when I add ticks like “new Date(‘input A’s value’)” it doesn’t actually generate a date. Convert text to date

The closest I’ve gotten still gives me this error “The plugin Toolbox / element Expression threw the following error: Error: Expected a date, but got a object (original data: null)”

Google & Stackoverflow seem to think that javascript’s date() function doesn’t do a good job of parsing ISO strings. Is that what I’m running into?

#180

Looks like it’s just sensitive to formatting. The time part needs a colon.

#181

I have a small issue/(misunderstanding ?) using bubble to java script in my app (value type : yes/no)

image

I fill it with a list of booleans by parsing a json string where the value is : ,“experiment”:false,
I then flip the values using a ionic toggle set to trigger :


image

I inspect my custom-state holding the modified values and it seems to be an ordinary boolean value

Trying to iterate my list to create an object to stringify, I get an error: no is not defined, or “nei” as it is in my native tongue.
I’ve tried using strings, numbers etc as the boolean value but there is always some fuss when either saving/parsing og stringifying.

When i inspect the element it says : nei = no
image
why not false,false,false etc…

Is there anything special as to how toolbox or bubble is handling lists of booleans, shold i just use strings ?
Is this just a common json parse/stringify problem :wink:

Anyone else found a solution/compromise ?

#182

Are you setting bubble_fn_experiment in the JSON Updater custom event?

The screenshot you posted shows that you are passing what you apparently want to that custom event. What does the custom event do with that workflow thing?