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

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

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

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

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

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

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

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment
  • 10 months later...
On 7/12/2023 at 1:20 AM, lindseykaszuba said:

@tuanphan I've just tried to insert the below code to remove the last name email block and am also getting the error below.

Website page: https://www.lindseykaszubahealth.com/join-email

I'd also like to remove last name from the footer on ALL pages. Can you help with that as well? 

Screen Shot 2023-07-11 at 2.19.11 PM.png

Use this new code

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
<script>
$(document).ready(function(){
	$('.last-name input').attr('value','NA');
  $('.last-name').attr('style','display:none;');
});
</script>

 

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

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment
On 7/16/2023 at 3:34 AM, lindseykaszuba said:

@tuanphanexcellent - that worked. Thank you so much! Do you have any code/steps to remove the last name field from the footer that is on all pages? 

I don't see Last Name in Footer. Can you check it again?

image.thumb.png.33c174a98117a85459c7dc5cfbae8832.png

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

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment
On 7/20/2023 at 12:55 AM, lindseykaszuba said:

@tuanphan it's been removed from the join email page but remains on all other pages. Do I need to adjust code for each individual page? 

Main site: https://www.lindseykaszubahealth.com/

Have you tried this code? It should run on all pages

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.0/jquery.min.js"></script>
<script>
$(document).ready(function(){
	$('.last-name input').attr('value','NA');
  $('.last-name').attr('style','display:none;');
});
</script>

 

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

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment
14 hours ago, lindseykaszuba said:

@tuanphanhere you go! Join email page - https://www.lindseykaszubahealth.com/join-email

Main website + scroll to bottom to see footer - https://www.lindseykaszubahealth.com/

I see it worked here (I just entered a test submission in newsletter footer, you can check in email)

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

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment
  • 2 months later...

I've added the share code but not working.

After adding code and loading the website Last name value will be "-" as defined in the code but when typing the First Name or email than Last Name value is updated and empty.

I tried jquery

keyup

to fill in the Last name but when I click the submit button the last name will be empty again.

Experts, would you please help me with this?

Thank you

Link to comment
On 10/20/2023 at 3:42 AM, bettylish123 said:

I've added the share code but not working.

After adding code and loading the website Last name value will be "-" as defined in the code but when typing the First Name or email than Last Name value is updated and empty.

I tried jquery

keyup

to fill in the Last name but when I click the submit button the last name will be empty again.

Experts, would you please help me with this?

Thank you

What is page url? We can check easier

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

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

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.