How could we have a returning webhook (303 location) call with query parameters trigger an interaction on a page? Wouldn’t it be great if there was a specific ‘Element trigger’ for URL parameters to trigger elements?
Use case: user sends a form on web page > our backend manages the submission > and returns the traffic back to the same page using webhook response 303 with the originating page URL + some added query parameters > to fire up a chosen element interaction on the web page like confirming that the submitted data was successfully received and processed.
We assume that there are no direct API calls or else by Webflow to fire up the element interactions by code?
Webflow’s inbuilt ‘Page Load’ trigger kind of works for now. It will though show up always when page is being entered first time - even if database is not truly updated by that ‘first’ page load yet. On subsequent occasions when user edits the data on page and triggers the form push to database the on page load “Success” popup is relevant notice as we trigger the 303 response only on successful data update.
More elegant option would be to use URL parameters to inform what to “say” on the page to the user.
This topic has been brought up already 2016 and 2017 on these closed discussions:
Typically I’d do this by having my own JS intercept the form submit event, and make the API call directly, that way the process ( success / error / data / messages ) can be immediately processed with no page refresh.
In terms of triggering interactions though you can use either approach.
Use a hidden button with a click trigger to trigger your interaction, and then use script to click the button. If you use the querystring approach, you’d just need an on-load script to check the querystring and act accordingly.
A button, here I’ll give it an id of my-button. Use the button as a trigger for your interaction. You can then mark that button as display: none to hide it.
JS to click it whenever you want that interaction to fire.