To find the element id, right click on the landing page, in the Google Chrome browser, and then click on Inspect.
<script type="text/javascript">
var zArrLen, zParentSelectedVal, zChildPicklistValue, zArrChildVal, zArrParentVal
var zPicklistMappingArray = new Array ()
// Update the below values with the Picklist ID obtained from previous step
var zParentPicklistId = "property.cust_FocusArea.value";
var zChildPicklistId = "property.cust_FocusSubarea.value";
// Update the Parent Child Picklist codes here, use the format ["parent picklist code", "Child Picklist code"]
zPicklistMappingArray = [
["FI","Compliance"],
["HR","PY"]
]
var zChildPicklistValues = document.getElementById(zChildPicklistId);
var zchildPicklistIdLen = zChildPicklistValues.length;
var zArrLen = zPicklistMappingArray.length;
function hideChildPicklists() {
for(i = 0; i <zchildPicklistIdLen ; i++) {
zChildPicklistValue = zChildPicklistValues[i];
zChildPicklistValue.hidden = true;
zChildPicklistValue.selected = false
if (zChildPicklistValue.value == ""){
zChildPicklistValue.selected = true
}
}
}
// Hide all childpicklist values on page load
hideChildPicklists();
document.getElementById(zParentPicklistId).onchange = function() {
hideChildPicklists();
zParentSelectedVal= document.getElementById(zParentPicklistId).value;
for(zArrCount = 0; zArrCount < zArrLen; zArrCount++){
zArrParentVal = zPicklistMappingArray[zArrCount][0]
zArrChildVal = zPicklistMappingArray[zArrCount][1]
if(zArrParentVal == zParentSelectedVal) {
for(i = 0; i <zchildPicklistIdLen ; i++) {
zChildPicklistValue = zChildPicklistValues[i];
if (zChildPicklistValue.value == zArrChildVal) {
zChildPicklistValue.hidden = false;
}
}
}
}
} ;
</script>
[
["<parent picklist code 1>"],["<child picklist code 1>"],
["<parent picklist code 1>"],["<child picklist code 2>"],
["<parent picklist code 2>"],["<child picklist code 1>"],
["<parent picklist code 3>"],["<child picklist code 1>"],
.
.
.
["<parent picklist code n>"],["<child picklist code n>"]
]
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
2 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |