Jump to content

Custom Newsletter Block w/ only First Name & Email

Go to solution Solved by tuanphan,

Recommended Posts

On 2/1/2020 at 3:02 AM, tuanphan said:
  window.Squarespace.onInitialize(Y, function(){
  sfSeconds = document.querySelector('.last-name input');
  sfSeconds.value = "NA";
  sfSecondsField = document.querySelector('.last-name');
  sfSecondsField.style.display = "none";
});

Hi everyone, I´m having the same issue and Im not being able to solve it. Ive tried different things and nothing is working. 

My site: https://redbow.org.nz/coming-soon-v02

Thanks!

Link to comment
On 11/17/2021 at 7:45 PM, Candelabra said:

Hi everyone, I´m having the same issue and Im not being able to solve it. Ive tried different things and nothing is working. 

My site: https://redbow.org.nz/coming-soon-v02

Thanks!

It looks like you figured it out?

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
  • 1 year later...

Hi there, I added the below code as footer code injection, but it still shows the last name "field" in my footer. What am I doing wrong? 

Website https://shallot-octahedron-m3zj.squarespace.com/home 

<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>

 

image.thumb.png.dc2b66b8310cdcb466b586817e4b88f7.png

Link to comment
On 8/21/2023 at 11:41 AM, BUROM said:

Hi there, I added the below code as footer code injection, but it still shows the last name "field" in my footer. What am I doing wrong? 

Website https://shallot-octahedron-m3zj.squarespace.com/home 

<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>

 

image.thumb.png.dc2b66b8310cdcb466b586817e4b88f7.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
1 hour ago, BUROM said:

@tuanphan unfortunately now the last name field shows up as NA. 

image.thumb.png.25e759e344b038a77e3689f07a94f72b.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 !important;');
});
</script>
<style>
  .newsletter-form-field-wrapper, .newsletter-block .newsletter-form-wrapper--layoutStack div.last-name {
    display: none !important;
}
</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
  • 1 month later...
On 10/18/2023 at 10:37 AM, definingability said:

Same problem here I've tried injecting every code in this thread and none of them have had any effect.

Try this code, if it doesn't work, please share link to your site

<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 !important;');
});
</script>
<style>
  .newsletter-form-field-wrapper, .newsletter-block .newsletter-form-wrapper--layoutStack div.last-name {
    display: none !important;
}
</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
  • 1 month later...
On 8/23/2023 at 4:41 PM, tuanphan said:

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>

 

Wow! This worked for me! Thank you 🙂 You're amazing!

Edited by Mengified
Link to comment
  • 3 months later...
On 3/28/2024 at 4:08 PM, findingmyway said:

Hi @tuanphan ive tried both codes in the footer (and header) and neither remove the last name field

https://divinelyfeminine.nz/

Which page are you referring to? Or you mean this newsletter popup?

image.thumb.png.ea6b4804e10a6968a16fa3600b4ece60.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 3/31/2024 at 5:33 PM, tuanphan said:

Which page are you referring to? Or you mean this newsletter popup?

image.thumb.png.ea6b4804e10a6968a16fa3600b4ece60.png

Is it possbile to be done - to remove the last name here? but still need to maintain last name for future sign ups on other pages i.e the store & checkout

Link to comment
1 minute ago, findingmyway said:

Is it possbile to be done - to remove the last name here? but still need to maintain last name for future sign ups on other pages i.e the store & checkout

This will require to use JavaScript code. Which template do you use? I will test it on my test site

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.