/
Service Selection for Forms

Service Selection for Forms

Default behavior of the Send2CRM website client is to submit forms to the default service only.

Each form may optionally specify one or more services submissions should be sent to.

Specifying Service(s)

Standard Forms

There are several options for specifying destination service(s) for forms within the document. Either way the serviceAlias value should be a string that references alias of the service (or services in a comma-separated list) to send the form submission to.

Dataset attribute

Add a data-service-alias attribute to the form element itself.

<form id="my-form" data-service-alias="default,myAlias">

Hidden field

Add a field to the form named serviceAlias.

<input type="hidden" name="serviceAlias" value="default,myAlias" />

Event listener

The serviceAlias property of the form submission object may be set to override default behavior.

let myForm = document.querySelector('#my-form'); // Listen for the send2crmFormSending event to modify the outgoing submission. myForm.addEventListener('send2crmFormSending', (evt) => { let formData = evt.detail; // Comma-separated list of service aliases to submit the form to. formData.serviceAlias = 'default,myAlias'; });

Programmatic Submissions

When sending submissions programmatically, the alias(es) of the destination service can be specified directly in the fourth parameter to the send() function.

This parameter may be omitted to send to the default service only.

Related content

Multiple Services
Multiple Services
More like this
Visitor Analytics to Multiple Services
Visitor Analytics to Multiple Services
Read with this
Attaching forms
Attaching forms
More like this
DotCMS Integration
DotCMS Integration
Read with this
Mapping
More like this
Additional settings
Additional settings
Read with this