With the following code I am able to hide a normal lookup column based on drop down, But multi select I am not being able to
In multi select the identifier is SelectCanditate;SelectResult
Should I provide it together or as two separate variable.
function hideWorkgroupControl() {
var control = getTagFromIdentifierAndTitle("select", "SelectCandidate", "Workgroup");
// var control = getTagFromIdentifierAndTitle("select", "SelectResult", "Personnel");
control.parentNode.parentNode.parentNode.style.display = "none";
//add an onchange event to the dropdown
getTagFromIdentifierAndTitle("select", "DropDownChoice", "Types").onchange = function () { ChangeEvent() };
}
function ChangeEvent() {
//get the dropdown
var dropDown = getTagFromIdentifierAndTitle("select", "DropDownChoice", "Types");
//get the selected value
var option = dropDown.options[dropDown.selectedIndex].text;
//get the control
var control = getTagFromIdentifierAndTitle("select", "SelectCandidate", "Workgroup");
//show hide based on your condition
if (option == "Workgroup") {
control.parentNode.parentNode.parentNode.style.display = "";
}
else {
control.parentNode.parentNode.parentNode.style.display = "none";
}
}
//this gets the field based on title identifier and tagname
function getTagFromIdentifierAndTitle(tagName, identifier, title) {
var len = identifier.length;
var tags = document.getElementsByTagName(tagName);
for (var i = 0; i < tags.length; i++) {
var tempString = tags[i].id;
if (tags[i].title == title && (identifier == "" || tempString.indexOf(identifier) == tempString.length - len)) {
return tags[i];
}
}
return null;
}