Search code examples
formssessionsquarespace

Redirect to page after successfully entering in information in Squarespace


I have a page in Squarespace that I only want viewable after someone inputs their contact information. For example, I would create a Form Block, and then direct them to the otherwise locked page so they can view for that session. But if they close the window, they would need to re-enter their information (Name + Email).

lets say the address to the otherwise unviewable page is www.website.com/access

Once the viewer puts in their Name + Email and hit submit, they can see the /access page. If they do that and say share the address with someone who has not entered in their information, then they would get the Form Block where they need to enter their information.

Is there a way to do this in Squarespace? Would that need to be done with some sort of PHP Session that can be injected into the header of the specific page?

Ideally it would be like if they could see the page which is normally hidden, but of course unless they are an admin, the page is not viewable to the public.


Solution

  • Squarespace doesn't support PHP since it uses JSON template, so you can't create a session there. Please refer to this page: https://support.squarespace.com/hc/en-us/articles/205815358-Custom-code-FAQ

    The only option to achieve this will be to create a cookie via JS and redirect if there is no cookie. The page will be still accessible if you turnoff the JS.

    Please have in mind that SquareSpace is very limited when it comes to this kind of changes.