Jump to content

Order Form Custom Code Injection

Recommended Posts

Hey everybody,

Trying to figure out a way to avoid a 3rd party form to include file upload. I injected HTML into the form, and it looks great. However, after submission, the data isn't included in the form storage locations (email and google drive). I assume the reason that doesn't work is because the form is given a unique id upon creation and that id is what is used to transmit data, making the JS injected AFTER the creation of the form invisible in the data transfer. Any ideas on how to get around this?

Here's the code I've injected into the footer:

<script>
    // If on order-form-page, inject file upload element
    if (document.URL.includes('/order-form-test')) {
        document.querySelector('#textarea-yui_3_17_2_1_1572443434525_3770').insertAdjacentHTML('afterend', '<h3>Please Upload Artwork Here</h3><input type="file" id="myFile"><br><br>');

        document.querySelector("#myFile").setAttribute("accept", ".doc,.jpg,.png,.jpeg,.docx,.pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document");
    };
</script>

 

Edited by dhayes22
Link to comment
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Please provide the site url that you have activated the code

Thanks dhayes22

Greeting, it's BeyondSpace, I am Squarespace dev focus on provide solutions to enhance feature that squarespace.com can't provide.
Feel free to check my current Squarespace Plugins Developement: Enable Pinch/Zoom on lightbox, Delivery Date Picker, Keyword Highlighter
If you find my answer fit your need, let's leave a like or upvote so others with the same issue can find their solution. Thank you

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.