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
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: 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
  • 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.