Kateryna_Lodova Posted March 14 Share Posted March 14 Hi! I'm trying to build the following scenario using Cover Page: 1. User enters an email on a page with a sign-up form. 2. Once submitted, the user is redirected to a /thank-you page, and the entered email address is set as a URL parameter: /thank-you?email=<user_email>. 3. We then use that parameter on the /thank-you page. While I've managed to make this work using a regular page and form, the scenario doesn't work with Cover Pages. I tried to add the following code to the POST-SUBMIT HTML form option and the Advanced page option. But it doesn't work (no errors, so I think it might be ignored). Can anyone advise if there is a solution, please? ### <script> document.addEventListener('DOMContentLoaded', function() { var form = document.querySelector('form[data-form-id="123456"]'); if (form) { form.addEventListener('submit', function(event) { event.preventDefault(); // Prevent default form submission var email = form.querySelector('input[type=email]').value; // Get the value of the email field var redirectURL = '/thank-you?email=' + encodeURIComponent(email); // Construct the redirect URL with email as a parameter YUI().use('node', 'squarespace-form-submit', function(Y) { (new Y.Squarespace.FormSubmit(form)).submit({ formId: '123456', collectionId: '', objectName: '', redirectUrl: redirectURL }); }); }); } }); </script> ### Link to comment
sorca_marian Posted March 14 Share Posted March 14 If your code worked on another page and on this not it might be because the Post Submit HTML only supports HTML lately. Check: 👨🔧👨💻 Contact me for development and design work - Freelancer Software engineer, Architect, and Designer UI/UX 🙋♂️ Squarespace Custom Web Development & Design 📅 Manage Tasks, Take Notes, and Upload Related Images 📹 Squarespace Tutorials for free - YouTube📹 💯🚀 I have worked on over 200 Squarespace sites with custom code for over 9 years 🙋♂️ Let's connect on LinkedIn Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment