chartreuse Posted May 30, 2020 Share Posted May 30, 2020 Hi, I'm using the Bergen template in Squarespace 7.1. I'd like to customize the "event text" that occurs immediately after you have clicked send via the contact form. The text that appears is "Submitting..." I would like to customize this to be a text of my choosing? I believe this was addressed in a thread back in September of 2019 but has since been taken down. Thank you! Link to comment
jpeter Posted May 30, 2020 Share Posted May 30, 2020 (edited) You can add this JS, replace the value of the submittingText variable with with your own: (function () { // Text to add when form is submitting. var submittingText = 'SUBMITTING!!'; // Select the node that will be observed for mutations var form = document.querySelector('form'); var submitButton = form.querySelector('input[type="submit"]'); var submitText = submitButton.value; // Options for the observer (which mutations to observe) var config = { attributes: true }; // Create an observer instance linked to the callback function var observer = new MutationObserver(function () { // Check to see if the form has a `submitting` class. var isSubmitting = form.classList.contains('submitting'); // Toggle betweeen the default submit text and the submitting text. if (isSubmitting) { submitButton.value = submittingText; } else { submitButton.value = submitText; } }); // Start observing the target node for configured mutations observer.observe(form, config); })(); Edited May 30, 2020 by jpeter paul2009 1 Link to comment
chartreuse Posted May 30, 2020 Author Share Posted May 30, 2020 Tried this without success unfortunately. Wondering if there's a CSS option? Link to comment
paul2009 Posted May 30, 2020 Share Posted May 30, 2020 (edited) The answer supplied above should work. In case it isn't obvious (to you or to others who read this), the code supplied is JavaScript, so it must be placed in Settings > Advanced > Code Injection > Footer and must be inserted in between 'script' tags. This means, type the following: <script> </script> and then place the supplied code between these two tags. You'll also need to be on a Business plan or higher (or a trial). 24 minutes ago, chartreuse said: Wondering if there's a CSS option? This isn't possible to do with CSS. Edited May 30, 2020 by paul2009 About: Squarespace Circle Leader since 2017. I value honesty, transparency, diversity and great design ♥.Work: Squarespace Developer and founder of SF Digital, building the features Squarespace didn't include™. Content: Links in my posts may refer to SF Digital products or may be affiliate links. Catch up on all the release notes and announcements 2023 [for Circle members only]. There's a public version here too!If I helped, you can thank me by clicking one of the emojis below. If you prefer, you can buy me a coffee.Improve your online store with our extensions. Link to comment
chartreuse Posted May 31, 2020 Author Share Posted May 31, 2020 Thank you so much all -- this did work out. Link to comment
seonto Posted May 13 Share Posted May 13 On 5/30/2020 at 1:45 PM, jpeter said: You can add this JS, replace the value of the submittingText variable with with your own: (function () { // Text to add when form is submitting. var submittingText = 'SUBMITTING!!'; // Select the node that will be observed for mutations var form = document.querySelector('form'); var submitButton = form.querySelector('input[type="submit"]'); var submitText = submitButton.value; // Options for the observer (which mutations to observe) var config = { attributes: true }; // Create an observer instance linked to the callback function var observer = new MutationObserver(function () { // Check to see if the form has a `submitting` class. var isSubmitting = form.classList.contains('submitting'); // Toggle betweeen the default submit text and the submitting text. if (isSubmitting) { submitButton.value = submittingText; } else { submitButton.value = submitText; } }); // Start observing the target node for configured mutations observer.observe(form, config); })(); Hi. Do you have this JS for new version too? SS changed the form list system on this May.. TT 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