Jump to content

summitdigitaluk

Circle Member
  • Posts

    77
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by summitdigitaluk

  1. Hi Rodrigo, My example refers to a Form Block. When you are editing the page you can find the data-form-id attribute by inspecting the code and looking for the correct form element. It can be a bit tricky whilst editing the page because there are extra elements laying over the top of all the blocks on the page which Squarespace use to show the edit buttons etc... If you inspect the page outside of the editor, it is a bit easier to find: These examples are from 2 different websites incase you were wondering why the ID is different! I hope this helps.
  2. Hi @Tom_Warfield. This does not require Developer Mode, but you may need to upgrade your plan to enable Code Injection. A basic example would be like this: <script> //Specific form button to disable/re-enable const buttonToDisable = document.querySelector('[data-form-id="5ecfda33f13530766af10f1d"] input[type="submit"]'); //Add 'disabled' attribute to the form button buttonToDisable.disabled = true; //Specific form input which needs custom validation let inputToValidate = document.querySelectorAll('[data-form-id="5ecfda33f13530766af10f1d"] input.text')[0]; //Listen for changes to our input inputToValidate.addEventListener('input', function(e) { //Do your validation on every keystroke. //A basic example below. You could use a JS library for more complex validate. if(this.value) { //A value has been entered, re-enable button and continue with standard Squarespace submission buttonToDisable.disabled = false; } }); </script> You would add this to your website's Footer by going to Settings > Advanced > Code Injection. You would need to further develop this example for a good user experience as the form button would do nothing until the user had added content to our specific input. But in principle, this would be a good starting point.
  3. Hi @Ima, I was having the same issue. I submitted a ticket to Squarespace and they identified that there was an issue with their code. It has now been resolved. To get your site back up and running you should just need to update your local Squarespace Server by opening a new terminal and running this command: npm install -g @squarespace/server You should now be on version 1.6.2. When you load up your site, you might need to refresh the content cached by adding the query ?nocache=true to the end of localhost:9000; like this: http://localhost:9000/?nocache=true That will get you the latest content from your site. I hope this fixes it for you. In the future, try contacting Squarespace directly too, they have always been very helpful to me.
  4. @michaeleparkour You are a genius. Such a simple solution! I was totally over-complicating it in my head.
  5. Has anybody had any experience with adding their own validation to a Squarespace form? Essentially stopping the normal submission process, checking some custom validation, then continuing as normal/stopping the submission if there was an invalid entry? I have a client that needs some number fields to be submitted within a specific range and a few other variations on this theme. I'm hoping to find a simple solution, but I'm also happy to go with a very complicated one 😆 @michaeleparkour Do any of your plugins do this, or perhaps this is something you have come up against?
×
×
  • 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.