I am trying to use js to hide SharePoint Document Library columns based on conditions. Using SP 2010.
I was able to hide drop-down columns based on an initial dro-down column value thanks to a former post: Hide/Show field on list form based on value from another field
However, I am struggling to hide a choice column based on a previous multi-select choice column.
Condition: If multi-select check box option Functional is checked, show next drop-down choice column titled "Functional". If the check-box Functional is not checked, hide the drop-down choice column "Functional".
The below works successfully for hiding a drop-down based on a former drop-down ( hide unless "Send Email" choice column = Leaders/SME). (Ignore the extra script in the snippet, by error)
<script src="…/Site%20Assets/jquery.min.js"></script>
<script src="…/Site%20Assets/SPUtilityjs.js"></script>
<script>
$(document).ready(function ()
{ // Get a the choice field
var choiceField = SPUtility.GetSPField('Send Email?');
// Hide the target fields in form load
SPUtility.GetSPField('Functional').Hide();
// create a function to show or hide a field based on the selected choice Field value
var ShowHideField = function() {
var selectedFieldValue = choiceField.GetValue();
// Hide the 'Functional' field if the selected value is not 'Leaders'
if(selectedFieldValue != 'Leaders/SME') {
SPUtility.GetSPField('Functional').Hide(); }
else { SPUtility.GetSPField('Functional').Show(); } };
// attach the function to choice field
$(choiceField.Dropdown).on('change', ShowHideField); });
The below does NOT work to hide a drop-down if a former Multi-select choice column doesn't have "Functional" option checked:
<script src="…/Site%20Assets/jquery.min.js"></script>
<script src="…/Site%20Assets/SPUtilityjs.js"></script>
<script>
$(document).ready(function ()
{ // Get a the choice field
var choiceField = SPUtility.GetSPField('Leaders/SME');
// Hide the target fields in form load
SPUtility.GetSPField('Functional').Hide();
// create a function to show or hide a field based on the selected choice Field value
var ShowHideField = function() {
var selectedFieldValue = choiceField.GetValue();
// Hide the 'Functional' field if the selected value is not 'Functional'
if(selectedFieldValue != 'Functional') {
SPUtility.GetSPField('Functional').Hide(); }
else { SPUtility.GetSPField('Functional').Show(); } };
// attach the function to choice field
$(choiceField.Checkbox).on('change', ShowHideField); });
</script>