Hiding a field based on contents of SP Checkboxes

Dear Ben,
Here is the code that will check if something is present in the Checkboxes field and if there is something - it will hide Title field. This triggers on form load and when Checkboxes field has any change:

fd.spRendered(function() {

    function hideOrShowFields() {
        if (fd.field('Checkboxes').value.indexOf("Enter Choice #1") >= 0) {
            // Hide the Title field
            $(fd.field('Title').$parent.$el).hide();
        } else {
            // Show the Title field
            $(fd.field('Title').$parent.$el).show();
        }
    }

    // Calling hideOrShowFields when the user changes the Start Date
    fd.field('Checkboxes').$on('change',hideOrShowFields);

    // Calling hideOrShowFields on form loading
    hideOrShowFields();

});

The code is taken from this article, and slightly modified to fit your case better. You can still find more information in the article.

1 Like