- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-26-2022 10:35 AM
Hi,
I'm populating a select box (database name) based on the application selected in the catalog item using client and script include. After submitting the catalog item, the select box is empty and when I click on it, it shows the option I have selected. Used the similar script for many other catalog items and its working fine. See this issue only for this.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var gr = new GlideAjax('getDb');
gr.addParam('sysparm_name','getDb1');
gr.addParam('sysparm_appName', g_form.getValue('app_name').toString());
gr.getXML(getdataname);
function getdataname(response){
g_form.clearOptions('u_dbName');
g_form.addOption('u_dbName','','---None---');
var msg = response.responseXML.documentElement.getAttribute("answer").split(',');
if(msg == ''){
alert('xxx');
g_form.clearValue('appName');
g_form.clearValue('appId');
g_form.clearValue('appLead');
}
else{
for(var i=0;i<msg.length;i++)
{
g_form.addOption('u_dbName',msg[i], msg[i]);
}
}
}
}
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-16-2022 08:44 AM
I have set the field 'clear variable name' to true in a UI policy by mistake. Set it to false and its working now. Thanks everyone for the inputs.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-16-2022 08:44 AM
I have set the field 'clear variable name' to true in a UI policy by mistake. Set it to false and its working now. Thanks everyone for the inputs.