The same as with jQuery
|
---|
$( document ).on( "b24-sitebutton-load", function (e, instance){ instance.buttons.add({ 'id': 'my-mail', 'href': 'mailto: jack@bitrix.com', 'title': 'Email me', 'target': '_self', 'sort': 1000, 'icon': 'http://sparkysite.com/medium/mails/mails01/mmail01.png', 'onclick': function() {console.log('button my-mail clicked!!!');}, }); }); |
CRM forms and site widget
Examples of site widget operation
Adding custom channel and a button
BX.addCustomEvent(document, "b24-sitebutton-load", function (e, instance){ instance.buttons.add({ 'id': 'my-mail', 'href': 'mailto: jack@bitrix.com', 'title': 'Email me', 'target': '_self', 'sort': 1000, 'icon': 'http://sparkysite.com/medium/mails/mails01/mmail01.png', 'onclick': function() {console.log('button my-mail clicked!!!');}, }); });
Modifying panel titles for forms
BX.addCustomEvent(document, "b24-sitebutton-load-widget-crmform", function (e, widget){ widget.caption = 'Form title'; }); BX.addCustomEvent(document, "b24-sitebutton-load-widget-callback", function (e, widget){ widget.caption = 'Call title'; });
The same as with jQuery
|
---|
$( document ).on( "b24-sitebutton-load-widget-crmform", function (e, widget){ widget.caption = 'Form title'; }); $( document ).on( "b24-sitebutton-load-widget-callback", function (e, widget){ widget.caption = 'Call title'; }); |
Passing the pre-set values to CRM form
BX.addCustomEvent(document, "b24-sitebutton-form-init", function (e, form){ form.fields = { 'values': { 'LEAD_PHONE': '8-100-032002-23400', 'LEAD_NAME': 'Jack' } }; });
The same as with jQuery
|
---|
$( document ).on( "b24-sitebutton-form-init", function (e, form){ form.fields = { 'values': { 'LEAD_PHONE': '8-100-032002-23400', 'LEAD_NAME': 'Jack' } }; }); |
Custom greetings message via events
BX.addCustomEvent(document, "b24-sitebutton-load", function (e, instance){ instance.hello.setConditions([{ 'icon': 'http://crm.bitrix24.com/upload/main/76d/52b.jpg', 'name': 'Victoria', 'text': 'Hello! Do you need any help?', 'page': '', 'delay': 1 }]); });
The same as with jQuery
|
---|
$( document ).on( "b24-sitebutton-load", function (e, instance){ instance.hello.setConditions([{ 'icon': 'http://crm.bitrix24.com/upload/main/76d/52b.jpg', 'name': 'Victoria', 'text': 'Hello! Do you need any help?', 'page': '', 'delay': 1 }]); }); |
© «Bitrix24», 2001-2024