Jump to content

Contact Form - Change "Submitting" Validation Text

Recommended Posts

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!

submit text.png

Link to comment

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 by jpeter

Full stack developer who loves helping people out with anything web related. If you'd like to support me, buy me a coffee!

Link to comment

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 by paul2009

About me: I'm Paul. A SQSP User for 18 yrs, I've been a Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥.
Work: Founder of SF.DIGITAL, providing high quality original extensions to supercharge your Squarespace website. 
Content: Views and opinions are my own. Links in my posts may refer to my own SF.DIGITAL products or may be affiliate links.
Forum advice is free. You can thank me by clicking one of the feedback emojis below. Coffee fuels my work.

Book paid help with domains: Connect a GoDaddy domain. Connect a Squarespace Domain. Domain assistance

Link to comment
  • 2 years later...

 

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.