Getting Values from Javascript (HTML block back into Bubble Database

Is there a way to get values stored in variable in javascript (html block) into the Bubble database.

CurrentUser’sDRINKS= DRINKS + 2; // doesn’t work.

I was doing a complex series of calculations via a many (30) steps in bubble, but that is slow when many multiple users visit my site at once. So I am trying to rewrite almost of all these steps via javascript html block.

Thanks,
David

I found this post Extracting content from HTML element but this information might be dated.

Currently three easiest ways …
1 . Use the Javascript to Bubble element or the Expression element in the Toolbox plugin.

2 . Write a value to an Input element, then collect its value.
3 . Write your own custom plugin.

You may find the HTML block tricky because the whole thing gets rerun when dynamic values change or screen size change. A good approach is to define functions in one HTML block, then call them from either another HTML block with the dynamic values, or from a workflow action with Run Javascript.

3 Likes

Thanks so much. I will look into these options.