Streaming live at 10am (PST)

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

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!

1 Like

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.

Hey @aaronocampo thanks for replying!

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

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.

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:

3 Likes

Awesome @PiterDimitrov! :webflow_heart:

1 Like

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

1 Like

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

2 Likes

No problem :raised_hands:

Hey @PiterDimitrov, I realized this was a couple years ago… I tried to follow the instructions as best I could but without the links working I think I misunderstood something along the way. Any chance you could help me out?

My setup is pretty much exactly the same, there’s a button link in the footer that I would like to go to a form on a separate page and auto-check a checkbox.

Thanks in advance!

@a_hlista
I had a similar issue as well and I was able to find a solution.
Here is a read only link for an example.
https://preview.webflow.com/preview/auto-checkbox-via-external-link?utm_medium=preview_link&utm_source=dashboard&utm_content=auto-checkbox-via-external-link&preview=370567eae62e832d27c6aafdcbe727c9&mode=preview

Let me know if you have any questions

-Jon

First, thank you so much! I really appreciate the reply.

I’m very very new to JS/Jquery and am slowly learning. The preview helped a lot but I feel like I messed something up along the way… or it might just be what I’m trying to do isn’t meant to work this way?…

The idea is for the “Wholesale” link in the footer to navigate to the Contact Us page and auto-check the box that’s attached to “I want to sell of use your product in my store or restaurant” (third from the top). The Wholesale link is apart of a global symbol (I’m not sure if that would make a difference or not since the url is the same).

I used the ID of “wholesale” for the link and the bit of jquery and placed the jquery in the header code of the Contact Us page.

Any ideas what could be causing the disconnect? Thank you in advance!!

https://preview.webflow.com/preview/fifth-season-new-782c8573e707e8635a74da?utm_medium=preview_link&utm_source=dashboard&utm_content=fifth-season-new-782c8573e707e8635a74da&preview=fb56d2b700524759b22287b055ff1891&mode=preview

No problem! Don’t worry I am quite new to jquery as well.

I’m not sure what is causing the disconnect. I just tested having a button link in a footer as a symbol and it has been working for me. The ID’s on your page seem to match up as well.
Only thing I can think of right now is that it only works after you publish the site and then try it (not in designer preview mode).

hmmm publishing didn’t work either.

https://fifth-season-new-782c8573e707e8635a74da.webflow.io/

Not a huge deal to launch without the function. I greatly appreciate the help, I’ll keep trying things. If you happen to think of something I’d love to hear it! :slight_smile:

I’m wondering if the other scripts used in the site could be messing something up? (again, very new)

I did try turning off the page load interactions on the off chance that was an issue but it’s didn’t fix it. Thanks again though!

Try this perhaps? Although it didn’t work for me in webflow :confused: but it works on my jsfiddle
https://jsfiddle.net/Lkm52qnr/1/

$("#wholesale").prop("checked", true);

edit: should have been ‘true’ not ‘false’

That didn’t work either… BUT! I did figure something out. When I removed all the custom styling and set everything on the checkbox back to “default” it worked! So now to figure out why some custom styling messed everything up. Thank you so much for all your help! This has been great to figure out!

That’s great to hear! Also my last code was incorrect. Should have been ‘true’ not 'false. My mistake!

Let me know if you find a solution for the styling! I feel like I might run down that same problem sometime down the road.