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

Custom Newsletter Block w/ only First Name & Email


hypochandrea

Question

25 answers to this question

Recommended Posts

  • 4

Add to Code Injection Footer

<script>
  window.Squarespace.onInitialize(Y, function(){
  sfSeconds = document.querySelector('.last-name input');
  sfSeconds.value = "NA";
  sfSecondsField = document.querySelector('.last-name');
  sfSecondsField.style.display = "none";
});
</script>

code by @paul2009, edited some lines by me.

7 hours ago, Pooks said:

Currently it is first and last name required or no name at all.

I would be really interested in the ability to just have first name and email as well.

 

Edited by tuanphan
tag

Email me if you have need any help (free, of course.). Answer within 24 hours.

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
  • 1
19 hours ago, newstaircase said:

The code here seems to work well on the surface, however it sets the value of Last Name for the new contact, literally to the text string 'NA', rather than it being null/empty, which is not quite the desired behaviour. You would need to take care not to include Last Name in any of your correspondence, to avoid emailing contacts something like, "Hello Ffion NA"! 

Screenshot 2021-05-13 at 16.47.39.png

Add new code

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

 

Email me if you have need any help (free, of course.). Answer within 24 hours.

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
  • 0
6 hours ago, MGN said:

HI there, I tried using the code but I keep getting an error syntax or something for the first line. Any suggestions?

Add to Home > Settings > Advanced > Code Injection > Footer

NOT CUSTOM CSS

Email me if you have need any help (free, of course.). Answer within 24 hours.

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
  • 0
On 8/27/2020 at 12:35 PM, pearler1570048501 said:

Hello! This didn't work for me on  Squarespace 7.1. Any ideas? Thank you!

Can you share link to page where you use form? We can check easier.

Email me if you have need any help (free, of course.). Answer within 24 hours.

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
  • 0
1 hour ago, JennyJenny said:

Are you able to tell what I did wrong?

Please give us the URL for the page where you want to suppress the Last Name field. If you've not already done so please set up a site-wide password. Post the password here and then we can take a look at your issue.

Find my contributions useful? Please like, upvote, mark my answer as best , and see my profile. Thanks for your support!

Link to comment
  • 0
On 2/1/2020 at 1:02 AM, tuanphan said:

Add to Code Injection Footer


<script>
  window.Squarespace.onInitialize(Y, function(){
  sfSeconds = document.querySelector('.last-name input');
  sfSeconds.value = "NA";
  sfSecondsField = document.querySelector('.last-name');
  sfSecondsField.style.display = "none";
});
</script>

code by @paul2009, edited some lines by me.

 

Hello! This worked for me on the newsletter block on my homepage, (thank you!) but I have another newsletter block on my contact page, and the removal of the last name does not reflect there. Any way to make this global for all newsletter blocks? I can share site and pw if necessary. Using Harris Template in York Family, so it's not a footer block like the Brine sites.

Link to comment
  • 0
11 hours ago, michenator said:

Hello! This worked for me on the newsletter block on my homepage, (thank you!) but I have another newsletter block on my contact page, and the removal of the last name does not reflect there. Any way to make this global for all newsletter blocks? I can share site and pw if necessary. Using Harris Template in York Family, so it's not a footer block like the Brine sites.

Can you share link to contact page? We can check easier.

Email me if you have need any help (free, of course.). Answer within 24 hours.

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
  • 0
18 hours ago, michenator said:

Thank you! https://tankarselfstorage.squarespace.com/contact // pw: packlikeapro

Newsletter blocks are at bottom of Contact page and bottom of Home page.

I think above code should work for all forms. If it still doesn't work, try disable Ajax Loading (Home > Design > Site Styles > Ajax Loading)

Email me if you have need any help (free, of course.). Answer within 24 hours.

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

Did you ever sort the 7.1 error @tuanphan ?

Your older code seems to work fine:
 

Quote

 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"
  })
      
     
 });

 

Edited by Kwamzilla

Specialising in Squarespace CSS and customisation.

If my answers have helped you, please drop a like and mark my answer as best to help other users find solutions quickly.

You can also thank me by buying me a coffee.

Link to comment
  • 0
Posted (edited)
On 2/1/2020 at 6:02 AM, tuanphan said:

Add to Code Injection Footer



<script>
  window.Squarespace.onInitialize(Y, function(){
  sfSeconds = document.querySelector('.last-name input');
  sfSeconds.value = "NA";
  sfSecondsField = document.querySelector('.last-name');
  sfSecondsField.style.display = "none";
});
</script>

code by @paul2009, edited some lines by me.

 

The code here seems to work well on the surface, however it sets the value of Last Name for the new contact, literally to the text string 'NA', rather than it being null/empty, which is not quite the desired behaviour. You would need to take care not to include Last Name in any of your correspondence, to avoid emailing contacts something like, "Hello Ffion NA"! 

Screenshot 2021-05-13 at 16.47.39.png

Edited by newstaircase
Added screenshot
Link to comment
  • 0

Site URL: https://midlandfoodtours.ca

How do I delete the 'last name' field in a newsletter block? It's on the website page linked to the 'Subscribe for Updates' button on my homepage.  I've tried different custom CSS in several forum posts but have not had any luck. 

website password: mft4567*

 

Link to comment
  • 0
On 5/24/2021 at 7:30 PM, kkurtz said:

Site URL: https://midlandfoodtours.ca

How do I delete the 'last name' field in a newsletter block? It's on the website page linked to the 'Subscribe for Updates' button on my homepage.  I've tried different custom CSS in several forum posts but have not had any luck. 

website password: mft4567*

 

It looks like you solved this?

 

Email me if you have need any help (free, of course.). Answer within 24 hours.

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
  • 0
On 5/24/2021 at 7:30 PM, kkurtz said:

Site URL: https://midlandfoodtours.ca

How do I delete the 'last name' field in a newsletter block? It's on the website page linked to the 'Subscribe for Updates' button on my homepage.  I've tried different custom CSS in several forum posts but have not had any luck. 

website password: mft4567*

 

Also, the site has some problems. If you need help, you can create a new questions, we will support.

Site URL – https://www.midlandfoodtours.ca/

1. (Tablet-Footer) Align left column links?

midlandfoodtours.ca-01-min.png

2. (Mobile-Footer) resize image?

midlandfoodtours.ca-02-min.png

3. (Mobile-Footer) Make logo smaller?

midlandfoodtours.ca-03-min.png

4. (Tablet-Overlay Menu) Increase line spacing?

midlandfoodtours.ca-04-min.png

5. (Tablet-Partners) Remove space before Midland text?

midlandfoodtours.ca-05-min.png

Email me if you have need any help (free, of course.). Answer within 24 hours.

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

Thanks for being so thorough on the site!

I'd still like to know how to have a newsletter block with just blocks for first name and email address.  Until I know how to do it, I went with the option to only require an email address. 

I do need help to fix the five other issues.  Some of them were issues on a tablet, and I've never seen my site displayed on a tablet before.

Thank you!

 

Link to comment
  • 0
18 hours ago, kkurtz said:

Thanks for being so thorough on the site!

I'd still like to know how to have a newsletter block with just blocks for first name and email address.  Until I know how to do it, I went with the option to only require an email address. 

I do need help to fix the five other issues.  Some of them were issues on a tablet, and I've never seen my site displayed on a tablet before.

Thank you!

 

Can you enable name field? We can check easier

Email me if you have need any help (free, of course.). Answer within 24 hours.

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
  • 0
On 5/29/2021 at 4:23 AM, kkurtz said:

I've enabled the name field again.

 

Use this new code

<script>
  window.Squarespace.onInitialize(Y, function(){
  sfSeconds = document.querySelector('.last-name input');
  sfSeconds.value = " ";
  sfSecondsField = document.querySelector('.last-name');
  sfSecondsField.style.display = "none";
});
</script>

Code by Sf.digital

Email me if you have need any help (free, of course.). Answer within 24 hours.

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