Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can we capture user events in dom from record.js in Sugar CRM 7.5?

Tags:

sugarcrm

How can we capture user events in dom from record.js in Sugar CRM 7.5?

For example: I have a select box in sugar CRM 7.5 record view. On change of this list i need to hide/show some fields in the interface.

Thanks in advance

like image 529
Jpec Avatar asked Dec 29 '25 18:12

Jpec


2 Answers

while in record.js you have access to the model object, which is the javascript representation of SugarCRM's Bean object

The SugarCRM model is an extension of a backbone.js model and you can and should use Backbone Events

in record.js :

initialize : {
     /** initialize code **/
     this.model.on('change:title' , function () {/*...*/})
}

However as mentioned beforethere are simpler ways to accomplish this without any javascript or PHP. Please see the studio tool located in the administration panel.

like image 89
paquino Avatar answered Dec 31 '25 07:12

paquino


There are different ways to achieve this

  • You can make your fields dependent if you only want to show hide the fields Ref
  • You can register your events in initialize function of record view controller file of your module see the sample code

this.on('field_name', this.functionName, this);

like image 37
Muhammad Saad Shahid Avatar answered Dec 31 '25 08:12

Muhammad Saad Shahid