Forum Academy Marketplace Showcase Pricing Features

Inputs populated with Javascript are seen as "empty"

I am using Javascript to insert some text into a multi-line input.

The text is visible, however Bubble thinks that the input is empty, which means I can’t do anything with it: I can’t validate it, I can’t save that data, I can’t send it in an email. It’s completely invisible to Bubble.

If the user clicks in the input and inserts a character, then suddenly Bubble “sees” it. However, setting and unsetting focus does not allow Bubble to see it.

Any workarounds to get Bubble to see the data that has been dynamically inserted via Javascript?

Does the user need to see/edit the text? If not, just send the text back up to Bubble (I assume you’re using Run JavaScript?) via JStoBubble.

(Even if u do need user edit, I’d do it this way and let your input’s initial value be the text output from JStoBubble.)


I don’t need the user to see it. I didn’t know about JStoBubble, I’ll check that out.

Will that require me to save to a DB? I just want to send the data directly in an email without sending.

FYI, I found this Javascript workaround to trick Bubble into seeing the change:

my_element.value = my_string;
var myEvent = document.createEvent("HTMLEvents");
myEvent.initEvent("change", false, true);

No, no need to save to database, the JStoBubble element is like a generic-ish Element plugin. You drop in on the page, configure its output by type (because Bubble plugin outputs require us to specify their type).

Then, by calling a function with the name you specify in JStoBubble, you can send values from Run JavaScript to the JStoBubble element.

1 Like

@brenton.strine - very simple example here "javascript to bubble plug in" does not return variables to the database - #2 by keith

This topic was automatically closed after 70 days. New replies are no longer allowed.