How to trigger a button on another page after clicking a link

Hey ho jchan!

Yes this is possible, you will need custom code.
There are multiple ways (with varying complexity) to achieve this:

URL-Parameters, — Cookies, — Web-workers

Okay, you will probably use url-params due to cookies being a tat overkill and webworkers being impossible to implement the “standard way” (no custom files in Webflow) and horrible to implement inline, as well for being overkill x 10. But it’s nice to know right?

[0] URL-Parameters:
You can dynamically add information or values to the URL, which can then on the page being navigated to – used to do stuff.

[1] Modifying the URL:
In Webflow you could give any button a fixed URL in the link-settings under the Element Settings (shortcut D). This is easy and useful IF the specific button only passes one parameter.

If the URL changes in the future you will need to update the link-setting manually - or the button breaks. That’s true for changes to the page that uses the parameter as well.

You can also compute the URL with parameters dynamically if the button is connected to multiple parameters (for example a form button and multiple inputs above it). This requires custom code on the origin-page too, instead of only the processing page.

So, let’s say you give the “Branding” button the URL:
https://yoursite.com/filter/example5`?branding=true`

The filter page now has the information the user provided via press of the button. You only need to utillise it.

[2] Getting the URL Parameter:
Place an inline-script above the </body> tag:

<script type="text/javascript">

// get url, get params from url, get specific param
var queryString = window.location.search,
urlParams = new URLSearchParams(queryString);

  // check if param exists
  if (urlParams.has('branding') === true) {
    branding = urlParams.get('branding');
    // toggle checkbox
    document.getElementById('branding').checked = true;
    // update content
    document.getElementById('YOUR_FORM_SUBMIT_BUTTON').click();
  }

</script>

IMPORTANT:
change the buttons on the filter page to checkboxes, otherwise it won’t work

Here’s a guide I found online, with more details:
get url params with javascript

Also have a look at:
Compatibility (caniuse.com)
Fallback for unsupported browsers - polyfill

This is a minimal guidance, you will need more tinkering to get this to work but I hope this helps a little :slight_smile:

Feel free to ask if you need additional help.