top_en

Bitrix24Care

Example of working with the new CRM form code

Despite the fact that you will have to work with the new form code less often, the solution of complex problems should be entrusted to a programmer or employee with the necessary level of competence.

We've already talked about New CRM forms designer, New design of the CRM forms, and Personalized CRM forms . In this article, we'll 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 it where you want.

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 form and place it where you want.

How can I add several contact forms on one page?

Copy the form code and place it where you want.

Can I set values in the form code for fields that are not placed on this form?

Yes, you can set values to all forms on the page or to one specific form. Remove /* and */ to include a script for a specific form, in this case with ID 792.

Place this script on the page BEFORE connecting the forms.

<script>
window.addEventListener('b24:form:init', (event) => {
    let form = event.detail.object;
    /*if (form.identification.id == 792) {
        form.setProperty("param1", "1");
        form.setProperty("city", "Kaliningrad");
    }*/
});
</script>

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": "Андрей",
        "last-name": "Неробей",
        "email": "andrey@example.com",
        "phone": "+79216011111"
    });
});
</script>
This helped
Thanks :)
This didn't help
Sorry :(
Could you please tell us why:
It's not what I'm looking for
It's too complicated
Send feedback