Jump to content

REMOVE Last name Email Field

Recommended Posts

Site URL: https://www.effektfootwear.com/signup

Hi all.

I have been scouring the web to figure this one out, found my way here, but cannot seem to get the code working.

I'm looking to remove the "Last Name" field required for email sign up.

I currently have business plan, have tried pasting a variety of codes I have found on the web and nothing seems to work.

I am trying to apply this to the landing page where I have successfully removed the header and footer as I want the sign up to be the only action people can take.

Is anyone able to help?

Thanks,

Ben.

Header Footer Removal.png

Edited by Benny_S
Link to comment

Add to Settings > Advanced > Code Injection > Footer

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
 const lnames = document.querySelectorAll('.last-name input')
   const lnameFields = document.querySelectorAll('.last-name')
  $(document).ready(function(){

     lnames.forEach(lname => {
   lname.value = "-"
  })

     lnameFields.forEach(lnameField => {
     lnameField.style.display = "none"
  })
      
     
 });
</script>
<style>
.newsletter-form-field-wrapper.field.last-name {
    display: none;
}
</style>

I think this code by @sf.digital

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

How to: Setup Password & Share url Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care

Link to comment
15 hours ago, Benny_S said:

Just gave it a go and doesn't seem to work

Its erroring, apparently the field still requires last name although the field block is not visible

Take a look at the attached.

Cheers,

Ben.

NOT WORKING.png

Keep this code in Code injection Footer, then let me know. Wee can test code easier

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

How to: Setup Password & Share url Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care

Link to comment
  • 5 months later...
On 5/14/2021 at 9:03 PM, tuanphan said:

Add to Settings > Advanced > Code Injection > Footer

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
 const lnames = document.querySelectorAll('.last-name input')
   const lnameFields = document.querySelectorAll('.last-name')
  $(document).ready(function(){

     lnames.forEach(lname => {
   lname.value = "-"
  })

     lnameFields.forEach(lnameField => {
     lnameField.style.display = "none"
  })
      
     
 });
</script>
<style>
.newsletter-form-field-wrapper.field.last-name {
    display: none;
}
</style>

I think this code by @sf.digital

Hi @tuanphan, I am using this on a client site and it's working perfectly on the newsletter subscriber field (yay!) however it's affecting my contact form on my Contact page – would you happen to know how to adjust the above code to just work for the newsletter subscribe?

 

Website: https://magnolia-sealion-mwc2.squarespace.com/contact
Password: TMR2021

 

Thank you so much!

Link to comment
On 11/13/2021 at 8:56 AM, JanuaryMade said:

Hi @tuanphan, I am using this on a client site and it's working perfectly on the newsletter subscriber field (yay!) however it's affecting my contact form on my Contact page – would you happen to know how to adjust the above code to just work for the newsletter subscribe?

 

Website: https://magnolia-sealion-mwc2.squarespace.com/contact
Password: TMR2021

 

Thank you so much!

Try this

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
 const lnames = document.querySelectorAll('.newsletter-block .last-name input')
   const lnameFields = document.querySelectorAll('.newsletter-block .last-name')
  $(document).ready(function(){

     lnames.forEach(lname => {
   lname.value = "-"
  })

     lnameFields.forEach(lnameField => {
     lnameField.style.display = "none"
  })
      
     
 });
</script>
<style>
.newsletter-form-field-wrapper.field.last-name {
    display: none;
}
</style>

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

How to: Setup Password & Share url Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care

Link to comment
  • 9 months later...
On 8/16/2022 at 10:43 AM, chewyyy said:

@tuanphanhi! I'm having trouble with my newsletter block using your code. It's successfully removed the field for last name but I keep getting this error:

the website is: thegoodclub.com 
pw: strawberry

thank you!

Screen Shot 2022-08-15 at 8.42.28 PM.png

I just try submit an email. It looks fine to me. Can you check it again?

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

How to: Setup Password & Share url Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care

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.