Description: Click Code Block - Open Form Popup in Squarespace.
Suppose you have a Code Block like this. This code will create a Button.
Note: This code will create button link.
Result
We can follow these steps to make Form Popup appears when users click this Code Block Button.
#1. First, click a Blank Page in Not Linked
You can place name/url: Form Popup – /form-popup
#2. Add a Form Block to this page
#3. Find ID of Form Block
In my example, it is: #block-yui_3_17_2_1_1732935090827_2496
#4. In Code Block, find
target="_blank"
and change it to
target="_self"
If you don’t see the target attribute, you can skip this step.
#5. Install this plugin
You can use code: TUAN to get 10% discount.
Plugin will give you some code to Code Injection Header/Footer
#6. Edit Code Block > Edit this link
to this link
#wm-popup=/form-popup#block-yui_3_17_2_1_1732935090827_2496
#7. Result
When you click button > Form Popup will appear.
#8. If you have 2 Code Blocks on Same Page. Just add 2 Form Blocks to /form-popup page
Next, find ID of both.
In my example, it is: #block-yui_3_17_2_1_1732936061586_2136 & #block-yui_3_17_2_1_1732935090827_2496
and use this format to link in Code Block 2
#wm-popup=/form-popup#block-yui_3_17_2_1_1732936061586_2136
Format
#wm-popup=/page-url#form-block-ID