Question

I have a list with a column named 'PROFESSIONALISM - Possessing a commanding presence' with 5 drop-down choices. I need the second column, 'P1 Explanation' (a multi-line of text field) to be hidden unless the first column's selection is "(1) - Not at All". The code below does not seem to be working and I cannot figure out why. I am new to this so thank you.

$(document).ready(function () {

    var QuestionField = SPUtility.GetSPField('PROFESSIONALISM - Possessing a commanding presence');


var showOrHideField = function() {
    var questionFieldValue = questionField.GetValue();

    if(questionFieldValue === '(1) - Not At All') {
        SPUtility.ShowSPField('P1 Explanation');
    }
    else {
        SPUtility.HideSPField('P1 Explanation');
    }
};

showOrHideField();


$(questionField.Dropdown).on('change', showOrHideField);});
Was it helpful?

Solution

You have defined the variable QuestionField at the beginning but subsequently you are trying to use questionField which is undefined. Check the capitalization.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top