# Getting Values from Javascript (HTML block back into Bubble Database

**URL:** <https://forum.bubble.io/t/getting-values-from-javascript-html-block-back-into-bubble-database/16019>\
**Category:** Questions\
**Created:** [July 28, 2017, 1:35pm UTC](https://forum.bubble.io/t/getting-values-from-javascript-html-block-back-into-bubble-database/16019 "2017-07-28T13:35:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidyjackson](https://avatars.discourse-cdn.com/v4/letter/d/6a8cbe/32.png) [@davidyjackson](https://forum.bubble.io/u/davidyjackson)\
**Post date:** [July 28, 2017, 1:35pm UTC](https://forum.bubble.io/t/getting-values-from-javascript-html-block-back-into-bubble-database/16019/1 "2017-07-28T13:35:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![davidyjackson](https://avatars.discourse-cdn.com/v4/letter/d/6a8cbe/32.png) [@davidyjackson](https://forum.bubble.io/u/davidyjackson)\
**Post date:** [July 28, 2017, 2:06pm UTC](https://forum.bubble.io/t/getting-values-from-javascript-html-block-back-into-bubble-database/16019/2 "2017-07-28T14:06:41Z")

</div>

I found this post [Extracting content from HTML element](http://forum.bubble.io/t/extracting-content-from-html-element/3085) but this information might be dated.

---

<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 31, 2017, 2:07am UTC](https://forum.bubble.io/t/getting-values-from-javascript-html-block-back-into-bubble-database/16019/3 "2017-07-31T02:07:15Z")

</div>

> [@davidyjackson](#):
>
> Is there a way to get values stored in variable in javascript (html block) into the Bubble database.

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

> [@Toolbox plugin - collection of utility elements](http://forum.bubble.io/t/toolbox-plugin-collection-of-utility-elements/11264):
>
> Announcing Toolbox, a plugin containing some element-based utilities. [image] [image] #List of Numbers Generate a list of numbers. Can be used to create a data source for a repeating group or dropdown. [image] #Javascript to Bubble Call a function from your custom javascript, to trigger a Bubble workflow event, and pass a value to be made available in Bubble. Properties: [image] Published value: [image] Sample HTML element: [image] Result: [image] #Expression Enter an expres…

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

> [@davidyjackson](#):
>
> So I am trying to rewrite almost of all these steps via javascript html block.

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.

---

<div class="post-metadata">

**Author:** ![davidyjackson](https://avatars.discourse-cdn.com/v4/letter/d/6a8cbe/32.png) [@davidyjackson](https://forum.bubble.io/u/davidyjackson)\
**Post date:** [July 31, 2017, 10:23am UTC](https://forum.bubble.io/t/getting-values-from-javascript-html-block-back-into-bubble-database/16019/4 "2017-07-31T10:23:57Z")

</div>

Thanks so much. I will look into these options.
