Disable choice field not working anymore

Hello Plumsail Team!

This line of code was working just fine a week ago:
fd.field(‘Status’).disabled = true;

Yesterday I noticed that the status field is now enabled but this line is still part of the code and no changes were made there. The are other fields on the form that are disabled using the same mechanism and there is no issue with them. Since the only difference I can think of is the type of the field, which is choice, I just tried to disable another choice field and it is not working for it as well. Is there any chance there is a breaking change from Microsoft on the choice field rendering that is causing this code not to work anymore? Just to mention that this is happening on multiple forms and in multiple browsers (IE & Chrome).

Kind regards,
Martin

Dear Martin,
There does seem to be a bug after the latest update! Thank you for the feedback, we’re currently working on fixing it ASAP.

As a temporary workaround, please, try:

//disable
$(fd.field("Dropdown").$el).find('span').attr('style','background: #EEE; pointer-events: none;');
//enable
$(fd.field("Dropdown").$el).find('span').attr('style','background: #FFF; pointer-events: auto;');

Thank you, Nikita. The workaround works fine. Just a minor correction in case somebody else is using that as well - you need to apply “#F1F3F5” as background color in order to be consistent with the other disabled fields.

1 Like

You are welcome! As for color, you are right, my bad, I was just giving an example, and yes, this works much better:

$(fd.field("Dropdown").$el).find('span').attr('style','background: #F1F3F5; pointer-events: none;');

Hopefully, this won’t be necessary soon.

@Nikita_Kurguzov It seems my issue relates to this one. I am finding that options I had set to hide based on some condition is no longer hidden.

My code:

var selectedoption = fd.field('Box_x0020_Status').value;
if(selectedoption == "Collected" || selectedoption == "Stored") {
    fd.field('Box_x0020_Status').disabled = true;
} else {
    var options = $(fd.field('Box_x0020_Status').$el).find('option');
    if(options){      
        for (var i = 0; i < options.length; i++){
            if(options[i].value == "Collected" || options[i].value == "Stored") {
                options[i].hidden = true;        
            }
        }
    }
}

Dear Andre,
Yes, indeed, there were changes and regular dropdown was replaced with Kendo Dropdownlist. To remove certain options from selection, please, use:

fd.field("Box_x0020_Status").widget.dataSource.data().remove("Collected");
fd.field("Box_x0020_Status").widget.dataSource.data().remove("Stored");
1 Like