I keep getting an error every time I am trying to insert some jquery/sputility code to get a SharePoint form field to be hidden if certain conditions are met. The error is "Unable to get SPField named ExternalSales". Here is the code:
<script src="<sharepoint site>/test/Shared Documents/jquery-3.1.1.min.js"></script>
<script src="<sharepoint site>/test/SiteAssets/sputility.js"></script>
<script>
$(document).ready(function () {
var externalsales = SPUtility.GetSPField('ExternalSales');
var showOrHideField = function() {
var externalsalesValue = externalsales.GetValue();
if (externalsalesValue == 'No') {
SPUtility.HideSPField('PPE');
}
else {
SPUtility.ShowSPField('PPE');
}
};
showOrHideField();
$(externalsales.Dropdown).on('change', showOrHideField);
});
</script>
With regards to the SPUtility syntax, how do I find out the strFieldName? I'm assuming that's the part that's incorrect.
Any help with this would be much appreciated.