DebLake Posted July 3, 2019 Posted July 3, 2019 Working on this page, and we'd like to auto fill the COUNTRY field with USA because none of our customers live anywhere else. https://www.americanwastemi.com/paperless I have reviewed all other posts on this topic, and have inserted all suggested code to either autofill, hide, or autofill and hide the country field in Design -> Custom CSS. The code below almost works, but it throws this error:Your form has encountered a problem. Please scroll down to review.Service Address is missing required subfields: Country Can anyone help? It seems that a lot of people have this problem, but the solutions that work are from 2017 and predate Squarespace's form verification updates. <script> Y.on("domready", function(){ Y.all('input[name="country"]').setAttribute("value", "US"); }); </script> <style> .field.country { display: none; } </style>
paul2009 Posted July 3, 2019 Posted July 3, 2019 The JavaScript isn't currently installed on this page but if it was, it wouldn't work. This is because the form has been added as a lightbox form. These aren't loaded until the user clicks the button to launch it, meaning that the code will load with the page, before the form or the country has been added to it. The code therefore can't precomplete the country information. If the form was directly on the page, it should (in theory) work as long as Ajax is disabled (the code you've used is old and isn't compatible with it) 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.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.