Jump to content

sambradley

Member
  • Posts

    3
  • Joined

  • Last visited

sambradley's Achievements

Level 1

Level 1 (1/20)

0

Reputation

  1. Thanks for the fast response. So just to confirm, I'm working on this page: https://www.little-loves.co.uk/thanksforyourrequest The block ID for the text we're replacing is #block-c6d10541e56caccb299c (though I've inserted this as 'c6d10541e56caccb299c' is that right)? And so the code I'm injecting is as follows: <script> (function(){ // Place the id of the text block between the quotes of TEXT_BLOCK_ID. // For information on how to get the text block id, see article below, // https://www.will-myers.com/articles/what-is-a-block-id-in-squarespace-and-how-to-find-one var TEXT_BLOCK_ID = 'c6d10541e56caccb299c'; var CONFIRMATION_TEXT = 'Thanks for your Booking'; var PARAMETER_NAME = 'FirstName'; /************************************************************************** * DO NOT EDIT ANYTHING BELOW THIS LINE UNLESS YOU KNOW WHAT YOU'RE DOING **************************************************************************/ if (document.readyState == 'loading') { document.addEventListener('DOMContentLoaded', init); } else { init(); } function init(){ TEXT_BLOCK_ID = TEXT_BLOCK_ID.replace('#', ''); var parameterValue = getParameterByName(PARAMETER_NAME); var textBlock = document.querySelector('#' + TEXT_BLOCK_ID); if(textBlock && parameterValue){ textBlock.textContent = CONFIRMATION_TEXT + ' ' + parameterValue; } } function getParameterByName(name, url = window.location.href) { name = name.replace(/[\[\]]/g, '\\$&'); var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'), results = regex.exec(url); if (!results) return null; if (!results[2]) return ''; return decodeURIComponent(results[2].replace(/\+/g, ' ')); } })() </script> To confirm, it doesn't seem to be working just yet. I imagine there's probably something I've missed? Sorry!!
  2. Hi, Thanks so much for coming back to me. To confirm, should this code be going in to Page Settings > Advanced > PAGE HEADER CODE INJECTION? Thanks in advance, Sam
  3. Site URL: https://www.little-loves.co.uk/ Hello! Wondering if someone can help me with a quick question... Not even sure if this is possible, but here goes... I'm building a Booking Confirmation page (/booking-confirmation) and the user gets directed here after they have completed by form on page (/booking-form). The booking form is made using Paperform which handles the redirect, when redirecting it can also append the URL to include data from the form submission. So for instance, if the user's name is Sam then the form can redirect like this: /booking-confirmation?FirstName=Sam Is there a way to have the Booking confirmation page 'read' any of that data in the URL and display it on the page? So for instance, if we want the text on the confirmation page to say "Thanks for your Booking [First Name]" is there a way to make that happen? I'm imagining this would involve setting up some kind of tag / dynamic text. Is it even possible? Thanks in advance! Sam
×
×
  • 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.