๐ฅBuild an Auto Submit Slate Form
Expanding upon the JavaScript for auto-submit originally shared here
โก Slate Form JavaScrip... | ReSource
There are two reasonable use-cases to auto-submit a form in Slate:
- Internal form with pre-filled or URL-parameter provided values, designed to provide 1-click actions in Slate
- Student-facing form for "as easy as clicking a button in an email" actions
- Example - "Are you still interested in Slate.edu? With three choices: Yes (auto-submits a Yes); No (auto-submits a No); or Maybe (auto-submits a Maybe)" >> it's a streamlined experience for the student, to not need to put in personal information all over again.
In either case, you can get away with just the "click submit" element of the JavaScript:
//Submit the form after ___ seconds
setTimeout(function () {
$(":button.default").trigger('click');
}, 5000);
The timeout value ("5000" value in this placeholder code) is how long the page will wait before submitting.ย
The value is in milliseconds
Three words of warning:
- You cannot set the timeout value too close to 0 - this can run afoul of Slate's spam prevention rules, and the form submission won't process.
- Any auto-submit can be jarring for the internal or external user, who will see the form splash up on their screen momentarily, and then proceed to the confirmation page.
- If you set the timeout too low and then go to Administratively edit or cancel the form submission on Timeline, Activities, or the form's Registration page, Slate will give you trouble, because you only have (for example) 1000 milliseconds to click the cancel button before it "auto-clicks" the submit button on the admin form submission dialog popup.
- Can be especially frustrating when testing and trying to cancel a form submission.
No comments to display
No comments to display