List or library control field change event

Hi ,

We have a list and library control placed in the form with inline editing enabled. I would like to know if its possible to disable one field on the list and library control based on the selection of the other field which is a dropdown. The edits are made inline so from the dropdown A,B or C is selected then another field should be automatically disabled.

Regards

Hello @Rinu,

Yes, this can be done using Edit event. Please find more information about List or Library events here.

Please see the code sample.

fd.control('SPDataTable0').$on('edit', function(editData) {

    //Check the field value when opening the item and disable the field
    if (editData.field('DropDown').value == 'active') {
        editData.field('Title').disabled = true;;
    }
    
    //Enable/Disable field when changing field value
    editData.field('DropDown').$on('change', function () {
        if (editData.field('DropDown').value == 'active') {

            //Disable Field
            editData.field('Title').disabled = true;;
        }
        
        else {
            //Enable Field
            editData.field('Title').disabled = false;;
        }
        
    });
    
});
1 Like