Skip to main content
Nintex Community Menu Bar
Question

how to make read only field when i checked check box in page

  • July 11, 2024
  • 1 reply
  • 3 views
  • Translate

Forum|alt.badge.img+3

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 = arguments[0], 
value = arguments[1]; 
//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 = renderers[dt]; 
        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’ 
    }
    


Did this topic help you find an answer to your question?
This topic has been closed for comments

Forum|alt.badge.img+11

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.

Translate

Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie Settings