Jump to content

Code Injection suddenly not working anymore

Go to solution Solved by paul2009,

Recommended Posts

Hi everyone,

I hope you are all having a great day.

I am facing issues with the CODE INJECTION feature. A few months ago, I added javascript in the SETTINGS > DEVELOPER TOOLS > CODE INJECTION menu (header and footer) in order to display or hide fields of a form depending on the user's choice in this form.

This was working perfectly for several months and I've had a lot of answers with the content and structure I was expecting to have.

I just noticed (based on the 2 latest form submission I received this week) that the Code injection is not working anymore. I haven't changed anything 😞. The form is working but the only field displayed is the first one...and the user's choice (Yes or No) has strictly no impact (it doesn't display any other filed).

The URL is : https://www.timinamour.com/rsvp

Could you please help me with this? Let me know if you need any clarification or additional information.

 

Header

<style>
	#radio-b49acd25-68d4-4998-9cb4-87de41fe53b6, /* how many adults ? */
  	#section-6d1d3dd3-243b-4add-b1ca-58b434ddbb6e, /* adult 1 */
  	#name-ed9df712-ed7f-4166-ad5e-95f5939b7e42, /* adult 1 NAME*/
  	#text-9fcdae28-107e-41bc-97c4-86f0677c559c,   /* adult 1 DIET */
    #section-cf917a58-70cc-40d1-8084-ab9bcf0f8479, /* adult 2 */
  	#name-9b360ad0-7505-4dd7-a6e7-a534324de75d, /* adult 2 NAME*/
  	#text-fc2ff666-73af-41fc-b251-e9777171a612,   /* adult 2 DIET */
   	#section-2e952926-134e-405d-99d7-56798f990476, /* adult 3 */
  	#name-9ce74532-d09d-4d78-805d-24b20eab7ffa, /* adult 3 NAME*/
  	#text-7d862f37-5a37-4157-bcdb-afb4b7e8ac56,   /* adult 3 DIET */ 
  	#textarea-0139bbd2-6855-41de-b897-5072b946800c,   /*  Sad News  */
  	#radio-550c702d-a084-4574-9521-e3fbd3067c5f, /* how many kids ? */
  	#section-0862f507-410e-4633-9a3b-9b0949d4c928, /* kid 1 */
  	#name-3fb01665-9078-4087-a95b-26112934b9bf, /* kid 1 NAME */
   	#text-72eb1d07-d81e-4e58-857f-0b3ca9df868a, /* kid 1 AGE */ 
  	#text-5183f464-3736-442f-8f07-dd0ed1359199,  /* kid 1 DIET */  
  	#section-57a8e5c2-fc57-417f-8ae6-af1cd5ec72df, /* kid 2 */
  	#name-7dec4027-30c6-47f7-9b23-7aec5068bccb, /* kid 2 NAME */
   	#text-fc9c3402-e6b3-4823-a817-339dbdcbda90, /* kid 2 AGE */ 
  	#text-05f6685c-fb3d-406b-b904-57a6439f65be,  /* kid 2 DIET */  
  	#section-7bb7c71b-5967-4936-b788-8ebfcec9d82a, /* kid 3 */
  	#name-29c0952c-89dd-4031-9036-fe838744dcb3, /* kid 3 NAME */
	#text-c7e7254f-0b2d-42c8-a1bb-584e36cda34d, /* kid 3 AGE */
  	#text-a6e8e725-13d3-4619-987a-aaa0260e8bb0,  /* kid 3 DIET */  
   	#section-1aebf5a0-d771-4a31-bbc5-b6b07609796e, /* kid 4 */
  	#name-9aea1e46-e13d-431c-b063-694eeac941dc, /* kid 4 NAME */
  	#text-b95801a6-c796-4b80-b397-eae656b55d59, /* kid 4 AGE */
  	#text-39200132-7fbc-4a7e-a3fb-52798636d434,  /* kid 4 DIET */
  	#textarea-76e2be7c-0b1e-403b-a6ff-42301062f899   /*  Comment / question  */
  
    {
      	display: none;
    }
  
    /* First name */
.field.first-name span.caption-text {
    visibility: hidden;
}
.field.first-name span.caption-text:before {
    visibility: visible;
    content: "First Name";
}
/* last name */
.field.last-name span.caption-text {
    visibility: hidden;
}
.field.last-name span.caption-text:before {
    visibility: visible;
    content: "Last Name";
}
  
  
</style>

 

FOOTER

<script src="https://code.jquery.com/jquery-3.6.3.min.js" integrity="sha256-pvPw+upLPUjgMXY0G+8O0xUf+/Im1MZjXxxgOcBQBXU=" crossorigin="anonymous"></script>

<script> 
	$('#radio-yui_3_17_2_1_1559225879525_55636 input').click(function() {
      	selection = $(this).val();
      	//alert(selection);
      	if (selection == 'OUI bien évidemment :)' || selection == 'YES of course :)' || selection == 'Ναι, φυσικά :)') {
          //$('.form-item').show();
    $('#textarea-0139bbd2-6855-41de-b897-5072b946800c').hide(); //Sad News
	$('#radio-b49acd25-68d4-4998-9cb4-87de41fe53b6').show(); //how many adults ?
           
   	$('#radio-b49acd25-68d4-4998-9cb4-87de41fe53b6 input').click(function() {
      	nbAdults = $(this).val();
      	if (nbAdults == '1') {
        	$('#section-6d1d3dd3-243b-4add-b1ca-58b434ddbb6e').show(); //adult 1 */
  			$('#name-ed9df712-ed7f-4166-ad5e-95f5939b7e42').show(); //adult 1 NAME*/
  			$('#text-9fcdae28-107e-41bc-97c4-86f0677c559c').show(); //adult 1 DIET */
   			$('#section-cf917a58-70cc-40d1-8084-ab9bcf0f8479').hide(); //adult 2 */
  			$('#name-9b360ad0-7505-4dd7-a6e7-a534324de75d').hide(); //adult 2 NAME*/
  			$('#text-fc2ff666-73af-41fc-b251-e9777171a612').hide(); //adult 2 DIET */
        	}
         else if (nbAdults == '2') {
        	$('#section-6d1d3dd3-243b-4add-b1ca-58b434ddbb6e').show(); //adult 1 */
  			$('#name-ed9df712-ed7f-4166-ad5e-95f5939b7e42').show(); //adult 1 NAME*/
  			$('#text-9fcdae28-107e-41bc-97c4-86f0677c559c').show(); //adult 1 DIET */
   			$('#section-cf917a58-70cc-40d1-8084-ab9bcf0f8479').show(); //adult 2 */
  			$('#name-9b360ad0-7505-4dd7-a6e7-a534324de75d').show(); //adult 2 NAME*/
  			$('#text-fc2ff666-73af-41fc-b251-e9777171a612').show(); //adult 2 DIET */     
         	} 
				$('#radio-550c702d-a084-4574-9521-e3fbd3067c5f').show(); // how many kids ? */
      		   	$('#radio-550c702d-a084-4574-9521-e3fbd3067c5f input').click(function() {
      				nbKids = $(this).val();
					if (nbKids == '0') {
						$('#section-0862f507-410e-4633-9a3b-9b0949d4c928').hide(); // kid 1 */
						$('#name-3fb01665-9078-4087-a95b-26112934b9bf').hide(); // kid 1 NAME */
						$('#text-72eb1d07-d81e-4e58-857f-0b3ca9df868a').hide(); // kid 1 AGE */ 
						$('#text-5183f464-3736-442f-8f07-dd0ed1359199').hide();  // kid 1 DIET */  
						$('#section-57a8e5c2-fc57-417f-8ae6-af1cd5ec72df').hide(); // kid 2 */
						$('#name-7dec4027-30c6-47f7-9b23-7aec5068bccb').hide(); // kid 2 NAME */
						$('#text-fc9c3402-e6b3-4823-a817-339dbdcbda90').hide(); // kid 2 AGE */ 
						$('#text-05f6685c-fb3d-406b-b904-57a6439f65be').hide();  // kid 2 DIET */  
						$('#section-7bb7c71b-5967-4936-b788-8ebfcec9d82a').hide(); // kid 3 */
						$('#name-29c0952c-89dd-4031-9036-fe838744dcb3').hide(); // kid 3 NAME */
						$('#text-c7e7254f-0b2d-42c8-a1bb-584e36cda34d').hide(); // kid 3 AGE */
						$('#text-a6e8e725-13d3-4619-987a-aaa0260e8bb0').hide();  // kid 3 DIET */  
						$('#section-1aebf5a0-d771-4a31-bbc5-b6b07609796e').hide(); // kid 4 */
						$('#name-9aea1e46-e13d-431c-b063-694eeac941dc').hide(); // kid 4 NAME */
						$('#text-b95801a6-c796-4b80-b397-eae656b55d59').hide(); // kid 4 AGE */
						$('#text-39200132-7fbc-4a7e-a3fb-52798636d434').hide();  // kid 4 DIET */
						$('#textarea-76e2be7c-0b1e-403b-a6ff-42301062f899').show();   //  Comment / question  */			
					}
					else if (nbKids == '1') {
						$('#section-0862f507-410e-4633-9a3b-9b0949d4c928').show(); // kid 1 */
						$('#name-3fb01665-9078-4087-a95b-26112934b9bf').show(); // kid 1 NAME */
						$('#text-72eb1d07-d81e-4e58-857f-0b3ca9df868a').show(); // kid 1 AGE */ 
						$('#text-5183f464-3736-442f-8f07-dd0ed1359199').show();  // kid 1 DIET */  
						$('#section-57a8e5c2-fc57-417f-8ae6-af1cd5ec72df').hide(); // kid 2 */
						$('#name-7dec4027-30c6-47f7-9b23-7aec5068bccb').hide(); // kid 2 NAME */
						$('#text-fc9c3402-e6b3-4823-a817-339dbdcbda90').hide(); // kid 2 AGE */ 
						$('#text-05f6685c-fb3d-406b-b904-57a6439f65be').hide();  // kid 2 DIET */  
						$('#section-7bb7c71b-5967-4936-b788-8ebfcec9d82a').hide(); // kid 3 */
						$('#name-29c0952c-89dd-4031-9036-fe838744dcb3').hide(); // kid 3 NAME */
						$('#text-c7e7254f-0b2d-42c8-a1bb-584e36cda34d').hide(); // kid 3 AGE */
						$('#text-a6e8e725-13d3-4619-987a-aaa0260e8bb0').hide();  // kid 3 DIET */  
						$('#section-1aebf5a0-d771-4a31-bbc5-b6b07609796e').hide(); // kid 4 */
						$('#name-9aea1e46-e13d-431c-b063-694eeac941dc').hide(); // kid 4 NAME */
						$('#text-b95801a6-c796-4b80-b397-eae656b55d59').hide(); // kid 4 AGE */
						$('#text-39200132-7fbc-4a7e-a3fb-52798636d434').hide();  // kid 4 DIET */
						$('#textarea-76e2be7c-0b1e-403b-a6ff-42301062f899').show();   //  Comment / question  */			
					}
					else
					if (nbKids == '2') {
						$('#section-0862f507-410e-4633-9a3b-9b0949d4c928').show(); // kid 1 */
						$('#name-3fb01665-9078-4087-a95b-26112934b9bf').show(); // kid 1 NAME */
						$('#text-72eb1d07-d81e-4e58-857f-0b3ca9df868a').show(); // kid 1 AGE */ 
						$('#text-5183f464-3736-442f-8f07-dd0ed1359199').show();  // kid 1 DIET */  
						$('#section-57a8e5c2-fc57-417f-8ae6-af1cd5ec72df').show(); // kid 2 */
						$('#name-7dec4027-30c6-47f7-9b23-7aec5068bccb').show(); // kid 2 NAME */
						$('#text-fc9c3402-e6b3-4823-a817-339dbdcbda90').show(); // kid 2 AGE */ 
						$('#text-05f6685c-fb3d-406b-b904-57a6439f65be').show();  // kid 2 DIET */  
						$('#section-7bb7c71b-5967-4936-b788-8ebfcec9d82a').hide(); // kid 3 */
						$('#name-29c0952c-89dd-4031-9036-fe838744dcb3').hide(); // kid 3 NAME */
						$('#text-c7e7254f-0b2d-42c8-a1bb-584e36cda34d').hide(); // kid 3 AGE */
						$('#text-a6e8e725-13d3-4619-987a-aaa0260e8bb0').hide();  // kid 3 DIET */  
						$('#section-1aebf5a0-d771-4a31-bbc5-b6b07609796e').hide(); // kid 4 */
						$('#name-9aea1e46-e13d-431c-b063-694eeac941dc').hide(); // kid 4 NAME */
						$('#text-b95801a6-c796-4b80-b397-eae656b55d59').hide(); // kid 4 AGE */
						$('#text-39200132-7fbc-4a7e-a3fb-52798636d434').hide();  // kid 4 DIET */
						$('#textarea-76e2be7c-0b1e-403b-a6ff-42301062f899').show();   //  Comment / question  */	
					}
					else if (nbKids == '3') {
						$('#section-0862f507-410e-4633-9a3b-9b0949d4c928').show(); // kid 1 */
						$('#name-3fb01665-9078-4087-a95b-26112934b9bf').show(); // kid 1 NAME */
						$('#text-72eb1d07-d81e-4e58-857f-0b3ca9df868a').show(); // kid 1 AGE */ 
						$('#text-5183f464-3736-442f-8f07-dd0ed1359199').show();  // kid 1 DIET */  
						$('#section-57a8e5c2-fc57-417f-8ae6-af1cd5ec72df').show(); // kid 2 */
						$('#name-7dec4027-30c6-47f7-9b23-7aec5068bccb').show(); // kid 2 NAME */
						$('#text-fc9c3402-e6b3-4823-a817-339dbdcbda90').show(); // kid 2 AGE */ 
						$('#text-05f6685c-fb3d-406b-b904-57a6439f65be').show();  // kid 2 DIET */  
						$('#section-7bb7c71b-5967-4936-b788-8ebfcec9d82a').show(); // kid 3 */
						$('#name-29c0952c-89dd-4031-9036-fe838744dcb3').show(); // kid 3 NAME */
						$('#text-c7e7254f-0b2d-42c8-a1bb-584e36cda34d').show(); // kid 3 AGE */
						$('#text-a6e8e725-13d3-4619-987a-aaa0260e8bb0').show();  // kid 3 DIET */  
						$('#section-1aebf5a0-d771-4a31-bbc5-b6b07609796e').hide(); // kid 4 */
						$('#name-9aea1e46-e13d-431c-b063-694eeac941dc').hide(); // kid 4 NAME */
						$('#text-b95801a6-c796-4b80-b397-eae656b55d59').hide(); // kid 4 AGE */
						$('#text-39200132-7fbc-4a7e-a3fb-52798636d434').hide();  // kid 4 DIET */
						$('#textarea-76e2be7c-0b1e-403b-a6ff-42301062f899').show();   //  Comment / question  */	
					}
					else if (nbKids == '4') {
						$('#section-0862f507-410e-4633-9a3b-9b0949d4c928').show(); // kid 1 */
						$('#name-3fb01665-9078-4087-a95b-26112934b9bf').show(); // kid 1 NAME */
						$('#text-72eb1d07-d81e-4e58-857f-0b3ca9df868a').show(); // kid 1 AGE */ 
						$('#text-5183f464-3736-442f-8f07-dd0ed1359199').show();  // kid 1 DIET */  
						$('#section-57a8e5c2-fc57-417f-8ae6-af1cd5ec72df').show(); // kid 2 */
						$('#name-7dec4027-30c6-47f7-9b23-7aec5068bccb').show(); // kid 2 NAME */
						$('#text-fc9c3402-e6b3-4823-a817-339dbdcbda90').show(); // kid 2 AGE */ 
						$('#text-05f6685c-fb3d-406b-b904-57a6439f65be').show();  // kid 2 DIET */  
						$('#section-7bb7c71b-5967-4936-b788-8ebfcec9d82a').show(); // kid 3 */
						$('#name-29c0952c-89dd-4031-9036-fe838744dcb3').show(); // kid 3 NAME */
						$('#text-c7e7254f-0b2d-42c8-a1bb-584e36cda34d').show(); // kid 3 AGE */
						$('#text-a6e8e725-13d3-4619-987a-aaa0260e8bb0').show();  // kid 3 DIET */  
						$('#section-1aebf5a0-d771-4a31-bbc5-b6b07609796e').show(); // kid 4 */
						$('#name-9aea1e46-e13d-431c-b063-694eeac941dc').show(); // kid 4 NAME */
						$('#text-b95801a6-c796-4b80-b397-eae656b55d59').show(); // kid 4 AGE */
						$('#text-39200132-7fbc-4a7e-a3fb-52798636d434').show();  // kid 4 DIET */
						$('#textarea-76e2be7c-0b1e-403b-a6ff-42301062f899').show();   //  Comment / question  */	
					}
					
                  });
    });
      
          

 
        }
        else
          	if (selection == 'NO unfortunately :(' || selection =='NON malheureusement :('  || selection == 'Δυστυχώς όχι :(')  {
        		//$('form').html('Thank you :(');
              	$('#radio-b49acd25-68d4-4998-9cb4-87de41fe53b6').hide(); //how many adults ?
                $('#section-6d1d3dd3-243b-4add-b1ca-58b434ddbb6e').hide(); //adult 1 */
                $('#name-ed9df712-ed7f-4166-ad5e-95f5939b7e42').hide(); //adult 1 NAME*/
                $('#text-9fcdae28-107e-41bc-97c4-86f0677c559c').hide(); //adult 1 DIET */
                $('#section-cf917a58-70cc-40d1-8084-ab9bcf0f8479').hide(); //adult 2 */
                $('#name-9b360ad0-7505-4dd7-a6e7-a534324de75d').hide(); //adult 2 NAME*/
                $('#text-fc2ff666-73af-41fc-b251-e9777171a612').hide(); //adult 2 DIET */
				$('#radio-550c702d-a084-4574-9521-e3fbd3067c5f').hide(); // how many kids ? */
				$('#section-0862f507-410e-4633-9a3b-9b0949d4c928').hide(); // kid 1 */
				$('#name-3fb01665-9078-4087-a95b-26112934b9bf').hide(); // kid 1 NAME */
				$('#text-72eb1d07-d81e-4e58-857f-0b3ca9df868a').hide(); // kid 1 AGE */ 
				$('#text-5183f464-3736-442f-8f07-dd0ed1359199').hide();  // kid 1 DIET */  
				$('#section-57a8e5c2-fc57-417f-8ae6-af1cd5ec72df').hide(); // kid 2 */
				$('#name-7dec4027-30c6-47f7-9b23-7aec5068bccb').hide(); // kid 2 NAME */
				$('#text-fc9c3402-e6b3-4823-a817-339dbdcbda90').hide(); // kid 2 AGE */ 
				$('#text-05f6685c-fb3d-406b-b904-57a6439f65be').hide();  // kid 2 DIET */  
				$('#section-7bb7c71b-5967-4936-b788-8ebfcec9d82a').hide(); // kid 3 */
				$('#name-29c0952c-89dd-4031-9036-fe838744dcb3').hide(); // kid 3 NAME */
				$('#text-c7e7254f-0b2d-42c8-a1bb-584e36cda34d').hide(); // kid 3 AGE */
				$('#text-a6e8e725-13d3-4619-987a-aaa0260e8bb0').hide();  // kid 3 DIET */  
				$('#section-1aebf5a0-d771-4a31-bbc5-b6b07609796e').hide(); // kid 4 */
				$('#name-9aea1e46-e13d-431c-b063-694eeac941dc').hide(); // kid 4 NAME */
				$('#text-b95801a6-c796-4b80-b397-eae656b55d59').hide(); // kid 4 AGE */
				$('#text-39200132-7fbc-4a7e-a3fb-52798636d434').hide();  // kid 4 DIET */
				$('#textarea-76e2be7c-0b1e-403b-a6ff-42301062f899').hide();   //  Comment / question  */
             
              
              	$('#textarea-0139bbd2-6855-41de-b897-5072b946800c').show(); //Sad News
            }
      
    });

</script>


Tim

 

Edited by Timour
Adding the URL
Link to comment
  • Solution
On 5/1/2023 at 8:57 AM, Timour said:

A few months ago, I added javascript...in order to display or hide fields of a form depending on the user's choice in this form.

This was working perfectly for several months. I just noticed that the Code injection is not working anymore. I haven't changed anything

Unfortunately, this code will no longer work because of a major “Form Block Update” currently being rolled out to all Squarespace sites.

This update improves forms for global visitors and includes functional changes to addresses, phone numbers, dates and times. For example, the date field will now render in a format that matches the device locale of the visitor. This means that an “en-US” visitor will see MM-DD-YYYY whereas an “en-GB” visitor will see the date correctly formatted as DD-MM-YYYY.

To make these changes, Squarespace engineers needed to completely change the way forms were created (including changing the technology used). The downside is that all third party and custom form automations will have broken, and will need to be rewritten if they are to function. You may want to contact the author of your code to see if they can help you.

If you have removed custom code and you are still experiencing issues with the new Form Block, please contact Squarespace Customer Care directly. If you experience any difficulties contacting Squarespace, please read how to contact Squarespace.

Did this help? Please give feedback by clicking an icon below  ⬇️

Edited by paul2009

Me: I'm Paul, a SQSP user for >18 yrs & Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥.
Work: Founder of SF.DIGITAL. We provide high quality original extensions to supercharge your Squarespace website. 
Content: Views and opinions are my own. Links in my posts may refer to my own SF.DIGITAL products or may be affiliate links.
Forum advice is completely free. You can thank me by selecting a feedback emoji. Buying a coffee is generous but optional.

Would you like your customers to be able to mark their favourite products in your Squarespace store?

Link to comment

Hi @paul2009

Thank you for your answer.

That's indeed not a good news. Do you have any idea how I should change the code to make it work? I am not a developer, but let's say I can give it a try as long as it's not extremely complicated.

Thank you

Tim

Link to comment

Hello,

I have tried injecting the code (the content of the script that is in the footer) directly in the Google Chrome Console and it works perfectly......whereas it is still not working at all when the code is injected via Squarespace.


image.thumb.png.1447af7842d7b0747b1cf95a1eed9c89.png

I am a bit lost about this issue 😞 

Looking forward to hearing for your ideas

 

Tim

Link to comment

Well guys, I have tried a ridiculous number of times to get information from the Squarespace customer service. But they just keep telling me that "this is code injection, we don't handle support for this"...so the rules of the game have change for the Form Block apparently but nobody on their side is willing to share with me the new rules of the game so that I can correct my code...

In summary, this forum is my only hope

Link to comment

I am experiencing the same issue. I built a form YESTERDAY and it worked fine. Today, not so much... JQuery on.('change') actions have no effect, not even a code error in Google Chrome console window. It's also affecting the CSS, although for the most part I have been able to fix that. Even the "placeholder" text has disappeared - that's part of SquareSpace's own system - I mean, wtf?

Similar lack of support from Live Chat, "we don't support this".
Very disappointing.

Another pre-existing form I made months ago for a separate site is also not working. I have tried to take the code back to basics to minimise room for error and reliance of #IDs, etc but still no joy. Very, VERY frustrating and is going to cripple my customers' forms - i.e. people can't contact them anymore.

If anyone has any ideas I would be keen to know! For reference, here's the code that's not working; pretty basic JQuery!

$(document).ready(function(){
    $('select').on('change', function() {

        //do some stuff

    });
});
</script>

Edited by WaiWeb
Link to comment

Apparently changes to a "Major Form Block Update" have stuffed up customised form code injection. 

I am experiencing the same issue. I built a form YESTERDAY and it worked fine. Today, not so much... JQuery on.('change') actions have no effect, not even a code error in Google Chrome console window. It's also affecting the CSS, although for the most part I have been able to fix that. Even the "placeholder" text has disappeared - that's part of SquareSpace's own system - I mean, wtf?

Similar lack of support from Live Chat, "we don't support this".
Very disappointing.

Another pre-existing form I made months ago for a separate site is also not working. I have tried to take the code back to basics to minimise room for error and reliance of #IDs, etc but still no joy. Very, VERY frustrating and is going to cripple my customers' forms - i.e. people can't contact them anymore.

If anyone has any ideas I would be keen to know! For reference, here's the code that's not working; pretty basic JQuery!

$(document).ready(function(){
    $('select').on('change', function() {

        //do some stuff

    });
});
</script>

 

See this post: 

 

Link to comment
1 hour ago, rainystaterealtor said:

I asked Squarespace support to remove me from the from block update and once they did that fixed the issues I was having with my form block.

Bear in mind that this will only offer you a temporary reprieve, which will only postpone the update. You will need to update your code to work with the new form block, otherwise your customisations will break again in the near future. 

Edited by paul2009

Me: I'm Paul, a SQSP user for >18 yrs & Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥.
Work: Founder of SF.DIGITAL. We provide high quality original extensions to supercharge your Squarespace website. 
Content: Views and opinions are my own. Links in my posts may refer to my own SF.DIGITAL products or may be affiliate links.
Forum advice is completely free. You can thank me by selecting a feedback emoji. Buying a coffee is generous but optional.

Would you like your customers to be able to mark their favourite products in your Squarespace store?

Link to comment

Please see the following. This is not a solution or specific to this thread but the comment applies to form customizers.

Depending on what you are doing you may need to use a MutationObserver in your code.

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
  • 2 weeks later...
On 5/5/2023 at 8:46 AM, rainystaterealtor said:

I asked Squarespace support to remove me from the from block update and once they did that fixed the issues I was having with my form block.

@rainystaterealtor@paul2009 @creedon
I just did the exact same thing and asked Squarespace to remove me from the FORM BLOCK UPDATE. They escalated the ticket and actually did it. I know it's just a temporary solution...
The agent stated "While our engineers are looking for a permanent solution, we deactivated the FORM BLOCK UPDATE on your website etc;"

Thank you

Tim

Link to comment
  • 3 weeks later...

<script src=  "https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js">
</script>


<script>
            $(document).ready(function() {

                   $("input:submit").click(function(n, c) {

                      var parentname =  $('#text-79257c74-ea4f-42d1-943c-b74dc6d571a6-field').val();
                     var parentemail =  $('#email-yui_3_17_2_1_1611537373374_4267-field').val();                   
                     var country =  $('#select-79f945a5-5f88-4a7a-b73f-d1661625020e-field').val();
                     var mobilenumber =  $('#text-003b1b2f-6427-40c6-8786-34f9bffd240a-field').val();              
                     var childname =  $('#text-bb4c5e6f-d471-49fc-9c85-6439cad9aa4b-field').val();
                     var Yearofschooling = $('input[name=radio-yui_3_17_2_1_1611536356559_147182-field]:checked').val()
                     var readingability =  $('input[name=radio-75d0359b-a556-43db-b5b0-468ead73c78f-field]:checked').val()

                      var password="";
                      var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
                      var charactersLength = characters.length;

                      for (var i = 0; i < 6; i++) {
                            password += characters.charAt(Math.floor(Math.random() * charactersLength));
                      }

                     $.ajax({
                       traditional: true,
                       url: "https://qadashboard.readingdoctor.com/api/ACCOUNT/Register",
                       type: "POST",
                       contentType: "application/json; charset=utf-8",
                       data:JSON.stringify( 
                        { 
                          "Password":password,
                          "ConfirmPassword":password,                
                          "Email":parentemail
                        }
                ),
                        success: function(data) {


                    $.ajax({
                      traditional: true,
                      url: "https://qadashboard.readingdoctor.com/api/School/UpdateChildStatus",
                      type: "POST",
                      contentType: "application/json; charset=utf-8",
                      data:JSON.stringify( 
                       [
                        { 
                        FirstName: parentname,
                        Email:parentemail,
                        Country:country,
                        Mobile:mobilenumber,
                        ChildFirstname:childname,
                        ChildSchooling:Yearofschooling,
                        ChildReadingability:readingability,
                        Password:password
                        }
                        ]
                        ),
                          success: function(data) {

                          },
                          error: function() {
                            alert("Parent Registration Failed");
                          }
                        });
                      },
                      error: function() {
                        alert("Parent Email already exits");
                      }
                    });


                   });
            });

</script>
 

 

code previous worked but its not working.. 

this code will triggers ajax call while clicking submit button in form

Link to comment
  • 1 month later...
On 5/1/2023 at 9:13 AM, paul2009 said:

Unfortunately, this code will no longer work because of a major “Form Block Update” currently being rolled out to all Squarespace sites.

Here's the thing...  It's been almost 3 months since you stated this, and: 
- The Code Injection options are still there in the page builders. 
- Your advertising specifically calls this out as one of the features of the Business and higher plans.
- I had the personal plan, went to Code Injections, and the feature was locked and I was told that to unlock it, I would need to upgrade to a Business Account or higher.

I went ahead and did that.  I upgraded to Business just so that I could inject Javascript into my page headers.  And now I find out that it doesn't actually work at all anymore, it hasn't for a while, and you are still selling and upgrade selling based upon this feature being there and working.

I contacted support and requested either an immediate refund, or an immediate fix to my site so that I can run my code.

You guys realize that that is textbook "Bait and Switch" and is illegal, right?  I mean you can't just do that...

 

 

Edited by alexf21
Link to comment
1 hour ago, alexf21 said:

It's been almost 3 months since you stated this. I upgraded to Business just so that I could inject Javascript into my page headers.  And now I find out that it doesn't actually work at all anymore

I'm not sure that I understand your post 🤔. Code Injection is still available and can used to add JavaScript to sites on Business Plans. There were changes to forms which have affected any code that was posted on this forum before May 2023, but you can still write new code and add it.

If you provide a link to the form on your site and explain what you'd like to be able to achieve, perhaps one of us can help.

Me: I'm Paul, a SQSP user for >18 yrs & Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥.
Work: Founder of SF.DIGITAL. We provide high quality original extensions to supercharge your Squarespace website. 
Content: Views and opinions are my own. Links in my posts may refer to my own SF.DIGITAL products or may be affiliate links.
Forum advice is completely free. You can thank me by selecting a feedback emoji. Buying a coffee is generous but optional.

Would you like your customers to be able to mark their favourite products in your Squarespace store?

Link to comment
  • 2 weeks later...

 

On 7/18/2023 at 5:58 AM, paul2009 said:

I'm not sure that I understand your post 🤔. Code Injection is still available and can used to add JavaScript to sites on Business Plans. There were changes to forms which have affected any code that was posted on this forum before May 2023, but you can still write new code and add it.

If you provide a link to the form on your site and explain what you'd like to be able to achieve, perhaps one of us can help.

What are the main changes to the process for executing changes to the old code ?

It be great if someone could share some examples of what the delta - code/processes that were and then had to become changed code/process  - 

Link to comment
5 minutes ago, smallmoves said:

What are the main changes to the process for executing changes to the old code ?

There are 1000s of changes and they aren't published. If your code is no longer working and you’d like some help from forum users, we’ll need to know some more detail. 

Me: I'm Paul, a SQSP user for >18 yrs & Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥.
Work: Founder of SF.DIGITAL. We provide high quality original extensions to supercharge your Squarespace website. 
Content: Views and opinions are my own. Links in my posts may refer to my own SF.DIGITAL products or may be affiliate links.
Forum advice is completely free. You can thank me by selecting a feedback emoji. Buying a coffee is generous but optional.

Would you like your customers to be able to mark their favourite products in your Squarespace store?

Link to comment

Thanks

 

Hiding fields on a radio button

 

HEADER
<style> 
    #formfield1,
      #formfield2 {
          display: none;
  }  
</style>

FOOTER

 

<script src="https://code.jquery.com/jquery-3.6.3.min.js" integrity="sha256-pvPw+upLPUjgMXY0G+8O0xUf+/Im1MZjXxxgOcBQBXU=" crossorigin="anonymous"></script>

<script>
  $('#radio-button').click(function() {
    selection = $(this).val();
    alert(selection);
    
    if (selection == 'Yes') {
              $('.form-item').show();
    }
    else
          if  (selection == 'No') {
        $('form').html('Thanks');            
  });
</script>

 

 

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.