AnsweredAssumed Answered

sidecar: required has no effect on css in header panel

Question asked by Harald Kampen on Dec 12, 2016
Latest reply on Dec 13, 2016 by Harald Kampen

Hi,

we add required by javascript in Leads record.js:

({       extendsFrom: 'RecordView',     initialize:function(options){         this._super("initialize",[options]);         this.model.addValidationTask('check_fields', _.bind(this._validateFields, this));     },     _requiredFieldListOnStatus: {       'primary_address_street':{}, 'primary_address_postalcode':{}, 'primary_address_city':{},       'primary_address_country':{},'account_name':{},'ps_brand_c':{}, 'first_name':{}, 'salutation':{}     },            _validateFields: function(fields, errors, callback) {         var error = false, rn;         for (rn in this._requiredFieldListOnStatus) {             if(_.isEmpty(this.model.get(rn))){                 errors[rn] = errors[rn] || {};                 errors[rn].required = true;                 error = true;             }         }         if(error){             app.alert.show('invalid-data',{level:'error',messages:'ERR_RESOLVE_ERRORS'});         }                 callback(null, fields, errors);     },     _fieldSetting: function() {         var self = this, converted = this.model.get('converted'), fl = this._requiredFieldListOnStatus;         _.each(this.meta.panels, function(panel){             _.each(panel.fields, function(field, index, list) {                           if (typeof field.fields == 'object' || typeof field.fields == 'array') {                     _.each(field.fields, function(f2, i2, l2) {                         self._fieldSettingField(f2, fl, converted, l2, i2);                     });                     list[index] = field;                 } else {                     self._fieldSettingField(field, fl, converted, list, index);                 }             });         }, this);      },     // cstm     _fieldSettingField: function(field, fl, converted, list, index) {         if (converted) {             list[index].readonly = true;             list[index].required = false;                     } else if (fl[field.name] != 'undefined') {             list[index].required = true;         }      },        _render: function(){         this._fieldSetting();                 this._super("_render");     } });

The required = true has effect on the group elements like primary_address_postalcode, but not in header panel element first_name.

How can I set the CSS class "required" for first_name and salutation?

 

Regards

Harry

Outcomes