Custom input data and post actions.

In this article you will learn what custom input data is and how you can use it for your own custom actions. You will also learn what the default actions are, and how to cancel them.

If you don't yet know what input data is how to add input data to a field, please read this article first.

Custom data

You can add custom data in the same way that you can add data for other services, like Teamleader and Mailchimp. Edit the input data of the field and add the custom data item. With this item you can add extra data to your input field. This data will be added to the HTML of the field, so it should be valid HTML to work. You could for example add a data attribute, by inserting data-input='custom' as the value.

Post actions

You can use the custom data in your post actions or in the form events. Post actions are the actions that you can add to your form. Read this article if you don't know what post actions are.

Listed below are the default post actions of the SiteManager form:

  • mail
  • teamleader
  • mailchimp
  • sheets
  • zapier

You can also add your own custom actions, by using the function postAction.

Cancelling default actions

Sometimes it could be necessary to execute form actions dynamically. For example, you might want to only send the data to Google Sheets, when an opt-in has been selected. This is possible by combining the submit.before event with the removeAction function.

smForm.on('submit.before', function() {
const optIn = this.form.querySelector('[data-optin]');
if (!optIn.checked) {
this.removeAction('sheets');
}
});