Skip to main content
Act-On Software

Using a Code Snippet to Auto-submit a Form

AUDIENCE: Administrators, Marketing Users, Web Developers
OBJECTIVES: 

  • Define the process for forcing Act-On forms to auto-submit
  • Define possible use cases for this functionality

FOR FORMS BUILT IN THE NEW COMPOSER:

Pasted below is a JavaScript snippet you can place on an Act-On landing page with an embedded Act-On form to cause them to auto-submit when the form loads and the pre-fill function has completed. It will also hide the form, so that it is invisible to the person clicking through.

<script>
aoPostLoadCallback = function(){
document.querySelector(".ao-form").style.display = "none";
setTimeout(function(){document.querySelector(".ao-form-submit").click()}, 1000);
}
</script>

 This can be pasted into the JavaScript settings section of the Act-On Landing Page

Screenshot_101917_110757_AM.jpg

FOR FORMS BUILT IN THE CLASSIC COMPOSER:

Pasted below is a JavaScript/jQuery snippet you can place on Act-On forms to cause them to auto-submit when the form loads.

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>
jQuery.noConflict();
jQuery(document).ready(function ( $ ) {
   $("input[name='Submit']").click();
});
</script>

 This can be pasted into the External Web Analytics Support text area in the Settings step of the form editor, or within a custom stationery. Please note that this script would also work on many non-Act-On forms, and other similar alternative scripts may work with Act-On-built forms as well.

Possible use cases for an auto-submit form

If a known visitor (someone who previously submitted a form or who has clicked a link in an Act-On-tracked email) opens a form, you can pull any previously-known system-fields for this person and write that data to a hidden field. For example, the following form would submit the following fields for previously-known submitters but not display any of the fields being collected:

 

REFERENCES:

  • Was this article helpful?