In this article, we will consider how to solve unusual tasks when using new forms.
How to place the same form several times on the same page?
Copy the form code and place the form on any page of the site.
Can I use a CRM form and a widget with this CRM form on the same page?
Yes, you can. Copy the code for the CRM form and insert it at any place on the page.
How can I add several contact forms on one page?
Copy the form code and insert it at any place .
How to set up autocomplete for hidden fields in a CRM form?
Add a hidden field to the CRM forms you want to place on your site and set its value, such as %test%.
Default values for hidden fields in CRM forms
Specify the value of the hidden field and the data to be recorded in this field in the script. For example, form.setProperty("test", "567"), where test is the hidden field value, and 567 is the data to be sent to the CRM. If the form contains multiple hidden fields, add code for each field.
The script will apply to all forms containing hidden fields with the specified parameters.
<script>
window.addEventListener('b24:form:init', (event) => {
let form = event.detail.object;
form.setProperty('test', '567');
});
</script>
To connect the script to a specific CRM form, include its ID in the code. For example, for a form with ID 14, the code will be form.identification.id == 14.
<script>
window.addEventListener('b24:form:init', (event) => {
let form = event.detail.object;
/*if (form.identification.id == 14) {
form.setProperty("test", "567");
}*/
});
</script>
To ensure data is transmitted correctly, place the appropriate script on the site BEFORE connecting the form.
How to specify field values for all widgets on the page?
Place this script on the page BEFORE connecting the widget.
<script>
window.addEventListener('b24:form:init', (event) => {
let form = event.detail.object;
form.setValues({
"name": "Michael",
"last-name": "Wilson",
"email": "michael@example.com",
"phone": "+11234567890"
});
});
</script>