Click actions allow you to change the behavior of buttons on your campaign forms. Two of the most common are the default Submit Form action and the Download Content Upgrade action. However, you can further extend the capability of buttons, even using them to trigger your own custom code!
We've added the Run Custom JavaScript action so you can implement more unique and specialized functionality in campaign forms. Perhaps you would like a button that opens a new tab for reference, but leaves your current page (and campaign form) visible? Make the appropriate call to the window.open()
method! Would you like to access or modify elements within the underlying webpage? Since the BDOW! script is loaded as part of the page, the JavaScript click action can utilize the document
object!
Testing a simple JavaScript click action
A simple way to test out the functionality is to use a basic alert popup.
Log into the BDOW! Site Manager and access the design tool (either by editing an existing form or creating a new one).
Select a Button (or add a new one).
In the Action subsection of the Design tab, use the dropdown to select Run Custom JavaScript.
You will see the code input field immediately below the dropdown. Just enter/paste your JavaScript into it. For this test, enter
alert("Hello, World!");
Note that you do not need to include any
<script>
tags.
That's it! Just be sure to apply your changes to the form to "deploy" your code!
This example may be a toy use case to demonstrate the feature, but any web developers on your team should be able to unlock some intriguing possibilities!