AnsweredAssumed Answered

Sugar 7 - Make select field readonly

Question asked by Ramon Marcondes on Sep 28, 2017
Latest reply on Sep 7, 2018 by Patrick McQueen

Hello.

There is some Sidecar / Javascript validation I'm doing to a custom module, in the CreateView (create.js) and RecordView (record.js) forms, to make a specific field (called 'sobre') "readonly" on changing another field value.

The 'onchange' logic worked, but the problem is that I've tried 3 different ways of making the 'sobre' field non-editable, but no success, the field is still editable...

//1st try:
module.noEditFields.push('sobre');

//2nd try:
_.each(module.fields, function(field) {
     if (_.isEqual(field.def.name, 'sobre')) {
              field.readonly = true;
     }
}, itemProposta);

//3rd try:
$("[aria-label='sobre']").prop('readonly', true);

What can I do to make the field readonly via Sidecar / Javascript / Jquery in create.js and record.js?

 

Any help would be appreciated.

Thanks.

Regards, Ramon

Outcomes