Streaming live at 10am (PST)

How? Button Click to go to new page (containing Form) and select appropriate Checkbox within Form


#1

Hello!

I’m trying to figure out how to have a button click carry data to a form across pages.

The use-case is for someone on a product page that clicks the button “i’m interested in product X” goes to the standard contact page with the form automatically selecting product X.

Currently, the form has a section of checkboxes - to be selected depending on product interest. So the button living on a product page should take the user to this form and select the appropriate form checkbox.

Hope that makes sense. Thank you!


#2

This can be done with custom code only, there is no way to do it just with the elements and options that you have in webflow.

Another option that you can try is using the CMS and have a form inside of the product page template to send the interest if a specific product although you’ll need custom code as well to add the URL or name of the product page you’re in to the form submission notification.

If you have a small amount of products I can see a couple of work arounds that we can discuss if you want, they wouldn’t be ideal but they could work.


#3

Hey @aaronocampo thanks for replying!

I would love to give it a shot with custom code on the button. What would you suggest?


#4

I’m no a coder per se. I know some guys have done it and there are a few threads here in the forum about that. I’ll try to look for them and post them here later.


#5

Hello @rossmcfadden

Here’s my approach

1. I have page A and page B > Page A contains the link > Page B contains the form with the checkboxes

2. I’m linking to page B using #myHash at the end of the link located on page A > mysite.com/page-with-form#myHash

3. I’m putting this script

<script>
$(document).ready(function(){
  var hash = location.hash;  // Here, it would be "#myHash"... So including the #

  if(hash=="#myHash"){
    $("#checkbox1").prop("checked", !$("#checkbox1").prop("checked") );  // that toggles the checked state
  }
});
</script>

before the closing body on page B

4. I’m adding an ID to the checkbox I want to be selected > ID > checkbox1

Here’s a screen record > https://www.useloom.com/share/38d698ecc44c4ba4876b9ad1c9dfb3af

Hope this helps

Piter :webflow_heart:


#6

Awesome @PiterDimitrov! :webflow_heart:


#7

Thanks! Not a coder, but stackoverflow and little testing helps :smiley:


#8

Awesome. Thanks so much @aaronocampo and @PiterDimitrov - you guys rock :rocket:


#9

No problem :raised_hands: