Hide/Reveal field on newform based on drop down
-
10-10-2020 - |
문제
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);});
해결책
You have defined the variable QuestionField at the beginning but subsequently you are trying to use questionField which is undefined. Check the capitalization.
제휴하지 않습니다 sharepoint.stackexchange