Jump to content

Remove Newsletter form Last name field from view and remove from data storage

Go to solution Solved by creedon,

Recommended Posts

Hi,

Site: theimerian.com

PW: B^tt3rB^tt

I am trying to remove the Last Name from the Newsletter subscribe form.  I found code in another post, and it does remove the Last Name from view, but apparently a value still needs to be added to the data storage field.  Is there a way to remove Last Name completely and not have 'NA' or '-' appended to the First Name?

This is what I have currently in the footer code injection.

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.0/jquery.min.js"></script>
<script>
$(document).ready(function(){
lastName = document.querySelector('.last-name input');
lastName.value = "-";
hideLastName = document.querySelector('.last-name');
hideLastName.style.display = "none";
});
</script>

Thank you in advance for your help.

 

 

Link to comment
  • Replies 2
  • Views 1.3k
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  • Solution
Quote

Is there a way to remove Last Name completely

No. You can hide it visually in the browser but that hiding has no effect on what SS expects to receive when the form is submitted. Hence you have to supply a value for the Last Name field behind the scenes.

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

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.