Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Advanced Search
  • 0
chartreuse

Contact Form - Change "Submitting" Validation Text

Question

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

Share this post


Link to post

4 answers to this question

Recommended Posts

  • 1
Posted (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 by jpeter

Share this post


Link to post
  • 1
Posted (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 by paul2009

sf-digital-signature-logo-email145.png.46606a2288a2847f44d81b9b7b58f3a5.png
Hi, I'm Paul, founder of SF Digital, a specialist company building the features that Squarespace didn't include
I am a Squarespace Developer and Squarespace Circle Leader with a
strong reputation on the Squarespace Forum. I'm trusted by thousands of Squarespace users worldwide, including designers, freelancers, business owners and agencies. My extensions add capabilities to Squarespace websites around the globe. They include the Enquiry Form ExtensionDatepicker Extension and Age Verification ExtensionNeed a custom Squarespace extension? Tell me about the functionality you need. Note that some links in my posts may be affiliate links. Book a Squarespace Expert when you need help.

Share this post


Link to post

Create an account or sign in to comment

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


×
×
  • Create New...