MobileCRM.UI.EntityForm.onSelectedViewChanged - Resconet/JSBridge GitHub Wiki
[v9.3] Binds or unbinds the handler for onSelectedViewChanged event on EntityForm.
Bound handler is called with the EntityForm object as an argument. The EntityForm context object contains "selectedView" property with the name of currently selected view.
Arguments
Argument | Type | Description |
---|---|---|
handler | function(entityForm) | The handler function that has to be bound or unbound. |
bind | Boolean | Determines whether to bind or unbind the handler. |
scope | Object | The scope for handler calls. |
This example demonstrates how to handle the tab (view) selection. It disables the address items when the Address tab is selected on Contact entity form having the parent customer defined.
MobileCRM.UI.EntityForm.onSelectedViewChanged(function (entityForm) {
/// <param name="entityForm" type="MobileCRM.UI.EntityForm"/>
if (entityForm.context.selectedView == "Address") {
var entity = entityForm.entity;
var dv = entityForm.getDetailView("Address");
var bEnable = !entity.properties.parentcustomerid;
dv.getItemByName("address1_line1").isEnabled = bEnable;
dv.getItemByName("address1_city").isEnabled = bEnable;
}
}, true, null);