Hide Options from Select Box

jessicaa_perry
Kilo Contributor

For the Create Incident form, I added Category as an option.  I was able to add this option and it inserts into the Incident table.  Success!

However, I only want a few categories available for our users to choose from in this form.  We'll call these internal vs. external categories.  How do I hide the internal categories?

After some research, I'm trying to use the onLoad function with the g_form.removeOption, but I can't seem to get it to work.  This is my first time working with client scripts.

15 REPLIES 15

Francisco Lopez
Kilo Explorer

Hello to everyone, for this expose case I suggest to implement the following client script, you need to consider that the variable where you going to show the option needs to be empty 🙂 (thats the trick )

 

function onChange(control, oldValue, newValue, isLoading) {
if (isLoading||newValue=="") {
return;
}

switch (newValue) {
case"marca_ibm":
//Remove options first for a possible option change 
 
g_form.removeOption(
"tipo_falla",
"Envia Mensaje Access Error LAN",
"Envia Mensaje Access Error LAN"
);
g_form.removeOption(
"tipo_falla",
"Envia Mensaje Communication with model layer has Failed",
"Envia Mensaje Communication with model layer has Failed"
);
g_form.removeOption(
"tipo_falla",
"Envia Mensaje Error de Acceso",
" Envia Mensaje Error de Acceso"
);

//Show the correct options base on the "marca_ibm" variable.
g_form.addOption(
"tipo_falla",
"Envia Mensaje Another instance of the Toshiba JavaPos drivers is already",
"Envia Mensaje Another instance of the Toshiba JavaPos drivers is already"
);
g_form.addOption(
"tipo_falla",
"Aplicacion no termina de cargar",
"Aplicacion no termina de cargar"
);
g_form.addOption(
"tipo_falla",
"Envia Mensaje Device Offline for logical name POS Printer 1",
"Envia Mensaje Device Offline for logical name POS Printer 1"
);

 
break;
}
}