How to call js function on record view of custom field

How to call js function on record view of custom field

Screenshot from 2016-04-13 19:54:26.png

Parents Reply Children
  • Hello Thanks for reply its done like below but

    ({

         extendsFrom: 'RecordView',

        initialize: function(options) {

            this._super('initialize', [options]);

           this.model.on('change:lead_fields',this._updateLeads);

           this.model.on('change:template_module',this._updatetm);  // if add this its not working

        },

       

         _updateLeads: function(model)

         {

             if($('[name="save_button"]').is(":visible")){  

             desc = this.model.get("description");

             selectedval = this.model.get("lead_fields");

             setval = desc + ' ' + selectedval;

             this.model.set('description',setval);

             this.model.set('lead_fields',"");

         }

        },

       

        _updatetm: function(model)

         {

             if($('[name="save_button"]').is(":visible")){  

             this.model.set('description',"");

         }

        },

    })

    What is Wrong in This... if i write just one function working perfectly .. but 2 function not working

  • Your events are missing this at the end

    this.model.on('change:lead_fields',this._updateLeads);

    this.model.on('change:template_module',this._updatetm);  // if add this its not working

    It should be:

    this.model.on('change:lead_fields',this._updateLeads, this);

    this.model.on('change:template_module',this._updatetm, this );