Hi,
Some help with a onChange catalog client script, if I select the below criteria:
query type does not populate, instead when you click on the drop down the whole variable list shows and its suppose to show "Other"
OR

or when I select "Files" query type does not populate, instead when you click on the drop down the whole variable list shows
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
if (newValue == '') {
alert('empty query type');
g_form.clearOptions('query_type');
}
g_form.clearOptions('query_type');
if (newValue === 'RSCA Campaign') {
g_form.addOption('query_type', '', 'None');
g_form.addOption('query_type', 'Workflow Changes (Update the Status)', 'Workflow Changes (Update the Status)');
g_form.addOption('query_type', 'Update the Due Date', 'Update the Due Date');
g_form.addOption('query_type', 'Delete', 'Delete');
g_form.addOption('query_type', 'Other', 'Other');
} else {
if (newValue === 'Assessment Objects') {
g_form.addOption('query_type', '', 'None');
g_form.addOption('query_type', 'Move to Another Business Entity/Amend Business Entity', 'Move to Another Business Entity/Amend Business Entity');
g_form.addOption('query_type', 'Update the RCSA Type', 'Update the RCSA Type');
g_form.addOption('query_type', 'Delete', 'Delete');
g_form.addOption('query_type', 'Other', 'Other');
} else {
if (newValue === 'Risks') {
g_form.addOption('query_type', '', 'None');
g_form.addOption('query_type', 'Workflow Changes (Update the Status)', 'Workflow Changes (Update the Status)');
g_form.addOption('query_type', 'Update the User fields (Capturer/Approver/Owner/Co-ordinator, etc.)', 'Update the User field(Capturer/Approver/Owner/Co-ordinator, etc.)');
g_form.addOption('query_type', 'Update the Fields', 'Update the Fields');
g_form.addOption('query_type', 'Delete', 'Delete');
g_form.addOption('query_type', 'Other', 'Other');
} else {
if (newValue === 'Controls') {
g_form.addOption('query_type', '', 'None');
g_form.addOption('query_type', 'Workflow Changes (Update the Status)', 'Workflow Changes (Update the Status)');
g_form.addOption('query_type', 'Update the User fields (Capturer/Approver/Owner/Co-ordinator, etc.)', 'Update the User fields (Capturer/Approver/Owner/Co-ordinator, etc.)');
g_form.addOption('query_type', 'Update the Fields', 'Update the Fields');
g_form.addOption('query_type', 'Delete', 'Delete');
g_form.addOption('query_type', 'Other', 'Other');
} else {
if (newValue === 'Test Plans') {
g_form.addOption('query_type', '', 'None');
g_form.addOption('query_type', 'Amend Start Date/Frequency/Next Test Date', 'Amend Start Date/Frequency/Next Test Date');
g_form.addOption('query_type', 'Workflow Changes (Update the Status)', 'Workflow Changes (Update the Status)');
g_form.addOption('query_type', 'Other', 'Other');
} else {
if (newValue === 'Test Results') {
g_form.addOption('query_type', '', 'None');
g_form.addOption('query_type', 'Amend Start Date/Frequency/Next Test Date', 'Amend Start Date/Frequency/Next Test Date');
g_form.addOption('query_type', 'Workflow Changes (Update the Status)', 'Workflow Changes (Update the Status)');
g_form.addOption('query_type', 'Delete', 'Delete');
g_form.addOption('query_type', 'Other', 'Other');
} else {
if (newValue == 'Programs' ) {
g_form.addOption('query_type', 'Other', 'Other');
} else{
if (newValue === 'Questionnaire Assessments') {
g_form.addOption('query_type', 'Other', 'Other');
} else {
if (newValue === 'Questionnaire Templates') {
g_form.addOption('query_type', 'Other', 'Other');
} else {
if (newValue === 'Risk Events') {
g_form.addOption('query_type', '', 'None');
g_form.addOption('query_type', 'Cancel Risk Event', 'Cancel Risk Event');
g_form.addOption('query_type', 'Move to Another Business Entity/Amend Business Entity', 'Move to Another Business Entity/Amend Business Entity');
g_form.addOption('query_type', 'Update the User fields (Capturer/Approver/Co-ordinator, etc.)', 'Update the User fields (Capturer/Approver/Co-ordinator, etc.)');
g_form.addOption('query_type', 'Error on Risk Event', 'Error on Risk Event');
g_form.addOption('query_type', 'Unlock/Lock RE', 'Unlock/Lock RE');
g_form.addOption('query_type', 'Workflow Changes (Update the Status)', 'Workflow Changes (Update the Status)');
g_form.addOption('query_type', 'Error on Non-Financial Impact Ratings', 'Error on Non-Financial Impact Ratings');
g_form.addOption('query_type', 'Delete', 'Delete');
g_form.addOption('query_type', 'Other', 'Other');
} else {
if (newValue === 'Event Recoveries') {
g_form.addOption('query_type', '', 'None');
g_form.addOption('query_type', 'Unlock/Lock Recovery', 'Unlock/Lock Recovery');
g_form.addOption('query_type', 'Move to Another Business Entity (Only for Multi Impacted)', 'Move to Another Business Entity (Only for Multi Impacted)');
g_form.addOption('query_type', 'Delete', 'Delete');
g_form.addOption('query_type', 'Other', 'Other');
} else {
if (newValue === 'Event Impacts') {
g_form.addOption('query_type', '', 'None');
g_form.addOption('query_type', 'Unlock/Lock Impact', 'Unlock/Lock Impact');
g_form.addOption('query_type', 'Move to Another Business Entity (Only for Multi Impacted)', 'Move to Another Business Entity (Only for Multi Impacted)');
g_form.addOption('query_type', 'Delete', 'Delete');
g_form.addOption('query_type', 'Error on Non-Financial Impact Ratings', 'Error on Non-Financial Impact Ratings');
g_form.addOption('query_type', 'Other', 'Other');
} else {
if (newValue === 'RCALL') {
g_form.addOption('query_type', '', 'None');
g_form.addOption('query_type', 'Unlock/Lock RCALL', 'Unlock/Lock RCALL');
g_form.addOption('query_type', 'Update the Status', 'Update the Status');
g_form.addOption('query_type', 'Update the User fields (Capturer/Approver/Co-ordinator, etc.)', 'Update the User fields (Capturer/Approver/Co-ordinator, etc.)');
g_form.addOption('query_type', 'Update the User fields (Capturer/Approver/Co-ordinator, etc.)', 'Update the User fields (Capturer/Approver/Co-ordinator, etc.)');
g_form.addOption('query_type', 'Workflow Changes (Update the Status)', 'Workflow Changes (Update the Status)');
g_form.addOption('query_type', 'Delete', 'Delete');
g_form.addOption('query_type', 'Other', 'Other');
} else {
if (newValue === 'ORX') {
g_form.addOption('query_type', 'Other', 'Other');
} else {
if (newValue === 'Key Indicators') {
g_form.addOption('query_type', '', 'None');
g_form.addOption('query_type', 'Update the User fields (Capturer/Approver/Owner/Co-ordinator, etc.)', 'Update the User fields (Capturer/Approver/Owner/Co-ordinator, etc.)');
g_form.addOption('query_type', 'Move to Another Business Entity/Amend Business Entity', 'Move to Another Business Entity/Amend Business Entity');
g_form.addOption('query_type', 'Workflow Changes (Update the Status)', 'Workflow Changes (Update the Status)');
g_form.addOption('query_type', 'Delete', 'Delete');
g_form.addOption('query_type', 'Other', 'Other');
} else {
if (newValue === 'Key Indicator Values') {
g_form.addOption('query_type', '', 'None');
g_form.addOption('query_type', 'Update the User fields (Capturer/Approver/Owner/Co-ordinator, etc.)', 'Update the User fields (Capturer/Approver/Owner/Co-ordinator, etc.)');
g_form.addOption('query_type', 'Delete', 'Delete');
g_form.addOption('query_type', 'Other', 'Other');
} else {
if (newValue === 'Issues') {
g_form.addOption('query_type', '', 'None');
g_form.addOption('query_type', 'Workflow Changes (Update the Status)', 'Workflow Changes (Update the Status)');
g_form.addOption('query_type', 'Update the Due Date', 'Update the Due Date');
g_form.addOption('query_type', 'Change the Issue Type', 'Change the Issue Type');
g_form.addOption('query_type', 'Issue Due Date Extension Error', 'Issue Due Date Extension Error');
g_form.addOption('query_type', 'Delete', 'Delete');
g_form.addOption('query_type', 'Other', 'Other');
} else {
if (newValue === 'Action Items') {
g_form.addOption('query_type', '', 'None');
g_form.addOption('query_type', 'Workflow Changes (Update the Status)', 'Workflow Changes (Update the Status)');
g_form.addOption('query_type', 'Update the User fields (Capturer/Approver/Owner/Co-ordinator, etc.)', 'Update the User fields (Capturer/Approver/Owner/Co-ordinator, etc.)');
g_form.addOption('query_type', 'Update the Due Date', 'Update the Due Date');
g_form.addOption('query_type', 'Delete', 'Delete');
g_form.addOption('query_type', 'Other', 'Other');
} else {
if (newValue === 'Assurance') {
g_form.addOption('query_type', 'Other', 'Other');
} else {
if (newValue === 'PA') {
g_form.addOption('query_type', 'Other', 'Other');;
} else {
if (newValue === 'UOM') {
g_form.addOption('query_type', 'Other', 'Other');
} else {
if (newValue === 'Business Entity') {
g_form.addOption('query_type', '', 'None');
g_form.addOption('query_type', 'Add/Update/Delete', 'Add/Update/Delete');
g_form.addOption('query_type', 'Update the User fields (Head of Ops Risk/CRO, etc.)', 'Update the User fields (Head of Ops Risk/CRO, etc.)');
g_form.addOption('query_type', 'Extract the Business Entity Structure', 'Extract the Business Entity Structure');
g_form.addOption('query_type', 'Other', 'Other');
} else {
if (newValue === 'Legal Entities') {
g_form.addOption('query_type', '', 'None');
g_form.addOption('query_type', 'Add/Update/Delete', 'Add/Update/Delete');
g_form.addOption('query_type', 'Other', 'Other');
} else {
if (newValue === 'Preference') {
g_form.addOption('query_type', '', 'None');
g_form.addOption('query_type', 'Add/Update/Delete', 'Add/Update/Delete');
g_form.addOption('query_type', 'Update the User fields (Capturer/Approver/Owner/Co-ordinator, etc.)', 'Update the User fields (Capturer/Approver/Owner/Co-ordinator, etc.)');
g_form.addOption('query_type', 'Update the Thresholds (RICM values)', 'Update the Thresholds (RICM values)');
g_form.addOption('query_type', 'Extract the Preferences with thresholds', 'Extract the Preferences with thresholds');
g_form.addOption('query_type', 'Other', 'Other');
} else {
if (newValue === ' Access') {
g_form.addOption('query_type', '', 'None');
g_form.addOption('query_type', 'Policy Violation', 'Policy Violation');
g_form.addOption('query_type', 'Errors', 'Errors');
g_form.addOption('query_type', 'Other', 'Other');
} else {
if (newValue === 'ORMS Access') {
g_form.addOption('query_type', '', 'None');
g_form.addOption('query_type', 'Prod', 'Prod');
g_form.addOption('query_type', 'PlayPen', 'PlayPen');
} else {
if (newValue === 'Cognos Access') {
g_form.addOption('query_type', '', 'None');
g_form.addOption('query_type', 'Prod', 'Prod');
g_form.addOption('query_type', 'PlayPen', 'PlayPen');
} else {
if (newValue == 'Cognos') {
g_form.addOption('query_type', '', 'None');
g_form.addOption('query_type', 'Build a new report', 'Build a new report');
g_form.addOption('query_type', 'Run/Query on Existing Report', 'Run/Query on Existing Report');
} else {
if (newValue == 'Files') {
g_form.addOption('query_type','Other', 'Other');
g_form.SetValue('query_type', 'Other');
}
}
}
}
}
//Type appropriate comment here, and begin script below
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}