Streaming live at 10am (PST)

Passing a custom value via button click for popup form

Hi everyone -

This might be SUPER easy (it always is!), but I was wondering if I can pass a value via a button click so that it populates a hidden value field.

So in other words, I have a bunch of buttons on a page. Each one of those buttons popup with a simple contact form. All of these forms are the same, I’m just looking to pass a variable that will show which form the user filled out.

Can this be achieved natively in webflow or do I need to add javascript so that I can pass that variable/value?

This is what my HTML embed looks like. All I want to do is dynamically populate the “value” depending on which button people click.

Thank you so much for any help!

Screen Shot 2021-05-14 at 12.19.51 AM

Anyone at Webflow who can help with this? I can’t seem to find any answers on this.

Looks like I partially got it via JS… However, when I click on the popup, the URL bar appends “/#?Offer=Foobar”… which is fine…

But when the form pops up in a modal, this JS script doesnt seem to work and returns a “undefined” value upon submit.

<script>
document.getElementById('Offer').value = window.location.href.split("=")[1];
</script>

Can anyone shed some light on this? Im super close!! :stuck_out_tongue: