AnsweredAssumed Answered

>7.9 set readonly in javascript

Question asked by Harald Kampen on Feb 15, 2019
Latest reply on Feb 18, 2019 by André Lopes


we are upgrading SugarCRM from 7.6 to 7.9 and setting readonly depending on values in Javascript does not work anymore. Cause the model is availble after rendering, setting a field to readonly has no effect when it's used in  this.on('render', ... or  this.model.once('sync', ...


We can't use PHP dependencies cause the readonly property should not be used by the API. This is an example code:


handleFieldProperties: function() {
     var type = this.model.get('list_type');         
     _.each(this.meta.panels, function(panel) {
        _.each(panel.fields, function(field, index, list){
            if (_.isString(field)) {
                field = {name: field};
            if (type == 'unique_campaign' && == 'description') {
                field.readonly = true;
                field.required = false;
                list[index] = field;
    }, this);

Has someone a solutions do set these fields to readonly and required = false?


Best regards

Harald Kampen##