I am trying to submit a simple waitlist form that includes the following fields:
Email address
Referral code
Referred BY code
Both 2 and 3 are hidden fields. 2 is auto generated using basic Javascript while 3 is pulled out of the url.
The desired behavior on form submission is that the users auto-generated referral code is forwarded to a redirect URL for a “success” page. That page should then include that user’s unique referral link that they can share and forward to friends.
The issue arises when I try to redirect the user after submitting the form. If I set the redirect URL for the form to the success page, the user’s submission is saved, but I have no way of adding the user’s referral code as a URL parameter. If I set the form submission button to Action: URL as a POST method… I now get the desired URL, but my form is no longer saved in the Webflow backend. I need both the URL parameter sent to the redirect AND the form submission to save to the Webflow backend.
Please help! This is extremely frustrating for such a simple scenario.
JS gives you all the capabilities you need here;
Some options-
You may be able to modify the referral URL directly using JS once to add your referral code. That when the form is submitted it already has the info needed.
Or, you could change your transfer mechanism so that instead of the URL querystring it uses session storage or something similar.
Alternatively you can add a JS event handler directly to your form, and on submission you do your handling and redirects specially.
All I did was paste in the URL to the submit ‘redirect’ field, set it to ‘GET’, and I expect each piece of form data to appended as parameters to said URL, but nothing happened.
Is there further set-up?
Instead, I pasted some custom code from the post below to the ‘before body’ page section the form is on, and it seemed to work fine, but I’d rather it worked out of the box