Jump to content

remove americanization spelling on forms state Zip code etc

Recommended Posts

Site URL: https://www.pebblesschoolofmotoring.co.uk

my client really wants to remove the american references on the forms on her website, so where it asks for zip code and state for example - how can i do this - do I have to build a new form? the password for the site is P388l3s - under construction still! i have two places thes needs to change on the contact page but also in the store where she is seling gift vouchers - I have added a custom form to make sure no one out of the local area purchases the voucher its deep in the sote settings for each product.

thanks in advance

Screenshot 2021-02-17 at 11.22.27.png

Screenshot 2021-02-17 at 11.24.55.png

Link to comment

For the contact form add the following to Design > Custom CSS. Replace my name with whatever is appropriate to localize those fields. Also in the comments you can replace x with whatever describes your local language.

/*

  begin replace some americanized text with x for contact form, using LESS
  syntax
  
  */
  
  #block-05fa448950bc630658b7 {
  
    .state-province .caption-text,
    .zip .caption-text

      {
      
        display : none;
        
        }
        
    .state-province .caption:after {
    
      content : 'creedon-sp';
      
      }
      
    .zip .caption:after {
    
      content : 'creedon-z';
      
      }
    }
    
  /*
  
    end replace some americanized text with x for contact form, using LESS
    syntax
    
    */

For the gift card form. Is that appearing on the checkout page? If so, we can not provide any code to modify it. It is a security feature of SS.

If is is not on the checkout page please point us to the page where the form(s) is/are.

Let us know how it goes.

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

Link to comment
28 minutes ago, jaggerdesign said:

creedon, Thanks! this worked perfectly, thanks so much. I hope the client will accept its a security issue for the store. 😉

Client wants Country field removed. is this possible?

Link to comment
Quote

Client wants Country field removed. is this possible?

If the address field is not required then it should be easily hidden.

It appears the above is no longer correct. It appears SS made is so that if any address field is filled in the they all have to be filled in. So you have to follow the required field technique.

If it is required then you have two options.

Build the address fields up yourself leaving out the country field, replacing the SS supplied address field. Kind of ugly.

Use a combination of CSS to hide the country field in the SS supplied address field and Javascript to populate the country field because it must have a value.

If the form is on page and not a pop-up or lightbox type form then the Javascript should be just a few lines of code. If it pops up then the code may get more complicated depending if the form is on the DOM or not before the popping up occurs. If it is not on the DOM then a mutation observer needs to be used to modify the form which is a bit complicated.

Edited by creedon

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

Link to comment
  • 1 year later...
On 2/24/2021 at 2:43 AM, creedon said:

If the address field is not required then it should be easily hidden.

It appears the above is no longer correct. It appears SS made is so that if any address field is filled in the they all have to be filled in. So you have to follow the required field technique.

If it is required then you have two options.

Build the address fields up yourself leaving out the country field, replacing the SS supplied address field. Kind of ugly.

Use a combination of CSS to hide the country field in the SS supplied address field and Javascript to populate the country field because it must have a value.

If the form is on page and not a pop-up or lightbox type form then the Javascript should be just a few lines of code. If it pops up then the code may get more complicated depending if the form is on the DOM or not before the popping up occurs. If it is not on the DOM then a mutation observer needs to be used to modify the form which is a bit complicated.

Hi, I have removed the state, adress 2 and country field with css. How do i populate the fields? The form is not lightbox or pop-up.

Link to comment

Instead of adding a pre-built American Address field you can add a number of Text fields to the form and name them however you like.

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
5 hours ago, Antonis said:

How do i populate the fields?

@paul2009's method has an advantage over modifying SS address form fields. When you hide fields they still have to be filled in with JavaScript. What you fill in, is filler, data that doesn't relate to what the user entered. That filler data rides along and becomes noise in the form that you need to remember to ignore.

If you decide not to use @paul2009's suggestion...

Please post the URL for a page on your site where we can see your issue.

If your site is not public please set up a site-wide password, if you've not already done so.

Post the password here.

Adding a site-wide password does not allow anyone to alter your site. It only allows those with the password to see your site. Please read the documentation at the link provided to understand how it works.

Please read the documentation at the link provided on how to share a link to your site to understand how it works. A link to the backend of the your site won’t work for us, i.e. a url that contains /config/.

We can then take a look at your issue.

Edited by creedon

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

Link to comment
On 7/8/2022 at 8:49 PM, creedon said:

@paul2009's method has an advantage over modifying SS address form fields. When you hide fields they still have to be filled in with JavaScript. What you fill in, is filler, data that doesn't relate to what the user entered. That filler data rides along and becomes noise in the form that you need to remember to ignore.

If you decide not to use @paul2009's suggestion...

Please post the URL for a page on your site where we can see your issue.

If your site is not public please set up a site-wide password, if you've not already done so.

Post the password here.

Adding a site-wide password does not allow anyone to alter your site. It only allows those with the password to see your site. Please read the documentation at the link provided to understand how it works.

Please read the documentation at the link provided on how to share a link to your site to understand how it works. A link to the backend of the your site won’t work for us, i.e. a url that contains /config/.

We can then take a look at your issue.

I  would like to make use of the java script method. The passwod is: Hello

https://semicircle-round-fzj6.squarespace.com/offerte-aanvragen

Link to comment

This particular technique no longer works after Squarespace released their new forms on Apr. 17th 2023.

On 7/10/2022 at 2:08 PM, Antonis said:

I  would like to make use of the java script method.

Add the following to Settings > Advanced > Page Header Code Injection for the page. Please see per-page code injection.

<script>

  document.addEventListener ( 'DOMContentLoaded', ( ) => {
  
    var country = '[enter country here between single quotes replacing square brackets]';
    
    var stateProvince = '[enter state province here between single quotes replacing square brackets]';
    
    // do not change anything below, there be the borg here
    
    document.querySelector ( '.country input' ).value = country;
    
    document.querySelector ( '.state-province input' ).value = stateProvince;
    
    } );
    
  </script>

Let us know how it goes.

Edited by creedon

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

Link to comment
On 7/11/2022 at 9:50 PM, creedon said:

Add the following to Settings > Advanced > Page Header Code Injection for the page. Please see per-page code injection.

<script>

  document.addEventListener ( 'DOMContentLoaded', ( ) => {
  
    var country = '[enter country here between single quotes replacing square brackets]';
    
    var stateProvince = '[enter state province here between single quotes replacing square brackets]';
    
    // do not change anything below, there be the borg here
    
    document.querySelector ( '.country input' ).value = country;
    
    document.querySelector ( '.state-province input' ).value = stateProvince;
    
    } );
    
  </script>

Let us know how it goes.

It worked perfectly, thank you!

Link to comment
  • 1 year later...

@creedon Is it possible to adapt these codes to only remove/hide the 'Country' sub-field in the Address field?

I applied the following scripts without success. 

URL: https://www.sobieskilocallion.com/sales-portal
PSW: Test
 

<style>
  
  .country {
    display : none;
    }
  .state-province .caption-text {
    display : none;
    }
  .state-province .caption::after {
    content : 'State';
    }
  
  </style>

AND 

// Add the following to Settings > Advanced > Page Header Code Injection for the page //

<script>

  document.addEventListener ( 'DOMContentLoaded', ( ) => {
    var country = '[enter country here between single quotes replacing square brackets]';
    var stateProvince = '[enter state province here between single quotes replacing square brackets]';
    
    // do not change anything below, there be the borg here

    document.querySelector ( '.country input' ).value = country;
    
    document.querySelector ( '.state-province input' ).value = stateProvince;
    
    } );
    
  </script>
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.