Help making button change input data

Hi folks,

I am trying to make a button change the input field just like the donation amount buttons here: https://emergencyhardshipfund.hubbub.net/p/UniofManchesterCauses/pledge/

I have tried what I think is everything without making it actually work! Please advise if this is possible, surely with everything else that bubble does this must be possible!

Thanks!

You could perhaps do this using custom states which hold the amount (each button pressed would modify the amount held in the custom state for example) and then after the workflow action which sets the custom state, add a ‘Run javascript’ action (that you get available from installing the Toolbox plugin) and put this in it

document.getElementById("myInput").value = "<your custom state value>";

Give your input field an attribute ID of “myInput” so when the JS runs it finds it and updates the value. That should hopefully do the trick!

Shame there is no workflow action in Bubble that will allow to update an input’s value. I don’t think there is anyway.

1 Like

Hi there,

I also have a similar use case in which I am setting the value using the following javascript script:
document.getElementById("myInput").value = "<Some value>"; as you mentioned. But when I print the same value in a bubble’s text element either it shows me the previous value or null, as the scenario may be. But not the updated value.

Were you able to get this through? Please share your solution.

@emmanuel Can this be a bug, in which when I set the value for any input field it should update the Value in the DOM but currently all I get is the visual of the set value but it cannot be accessed further within Bubble’s ecosystem. Do share your thoughts on this and a workaround if possible.

Thanks.

I understand what you mean, I’ve had the same thing happen but I don’t know how to fix that one. I suspect there will be a way but not too sure. @NigelG might come up with something or offer some advice.

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