Skip to content

MobileCRM.UI.DetailViewItems.TextBoxItem.constructor

rescocrm edited this page May 15, 2023 · 9 revisions

Constructs an instance of MobileCRM.UI.DetailViewItems.TextBoxItem object.

Arguments

Argument Type Description
name String Defines the item name.
label String Defines the item label.

This example demonstrates how to get detail view and create new TextBoxItem.

MobileCRM.UI.EntityForm.requestObject(function (entityForm) {
	var detailView = entityForm.getDetailView("General");
	var item = detailView.getItemByName("Description");
	if (item)
		item.value = "first line \n second line";
	else {
		item = new MobileCRM.UI.DetailViewItems.TextBoxItem("Description", "Description (max 2 lines)");
		item.value = "first line \n second line";
		item.numberOfLines = 2;
		detailView.insertItem(item, -1); // Place the item as the last one.
	}
}, MobileCRM.bridge.alert);
MobileCRM.UI.EntityForm.onChange(function (entityForm) {
	if (entityForm.context.changedItem == "Description") {
		var detailView = entityForm.getDetailView("General");
		var item = detailView.getItemByName("Description");
		MobileCRM.bridge.alert(item.value); // Show an alert with changed length
	}
}, MobileCRM.bridge.alert, null);
Clone this wiki locally