Skip to main content

once click to the inactive checkbox is true after I want to make read-only field otherwise field mode is read inline edit mode.

I have used some javascript for this functionality but read-only is work but when I uncheck inactive field than not able to edit.

var field = argumentsn0], 
value = argumentse1]; 
//field.mode = ‘read’; 
var $ = skuid.$;

var modelWF = skuid.model.getModel(‘Account’);
    var modelWFSize = skuid.model.getModel(‘Account’).data.length;
    var rowE = modelWF.getFirstRow();
    var checkInactive= rowE.Inactive__c;
    
    
    if(modelWFSize >0 && checkInactive == true){
        field.mode = ‘readonly’; 
        console.log(‘====CHECKTRUE ‘+checkInactive);
        var renderers = skuid.ui.fieldRenderers; 
        var dt = field.metadata.displaytype; 
        var r = rendererstdt]; 
        if (!r) r = renderers.TEXT; 
        r.readonly(field,value);
    }
    if(modelWFSize >0 && checkInactive == false){
        console.log(’====CHECKFALSE: ‘+checkInactive);
        field.mode = ‘read’;
        var renderers = skuid.ui.fieldRenderers; 
        var dt = field.metadata.displaytype; 
        var r = renderersÂdt]; 
        if (!r) r = renderers.TEXT; 
        r.read(field,value);

        //console.log($(’.nx-basicfieldeditor:visible’).length);
        //var fieldeditor = $(‘.nx-basicfieldeditor:visible’).data(‘object’);
        //fieldeditor.mode = ‘read’ 
    }
    


I do this by putting the field on the page twice, once in inline edit mode, the 2nd time in read only mode.  I then conditionally render the correct field based on your checkbox.