removing options in a dropdown

scottjus82
Kilo Guru

Hey all,

I cant work out why my scripts are not working. i need to do this this on two different tables/locations

1. Catalog item. I need to remove an option dependent on the answer to the previous question. my script is below, I have changed this several times but cant work out what is wong with my script. I guess the first question is can this be done on a catalog item?

function onChange(control, oldValue, newValue, isLoading) {

      if (isLoading) {

            return;

  }

    var ecms_mob = g_form.getValue('ecms_mobile');

    if (ecms_mob =='No'){

          g_form.removeOption('device_type', 'Smartphone');

    }

}

2. Removing resolved as an option based on an incident being a new ticket.

function onLoad() {

    if (g_form.isNewRecord())

          g_form.removeOption("state", 6);

}

I have been going around in circles on these, if someone could point out the problem it would be most appreciated.

Thanks

11 REPLIES 11

Just to confirm, the value and fields have been copied and pasted from the variables. Even the "No" just to be certain!


Yeah, we use it in our own Catalog Client Scripts with success, so it should work for you.


I did this in my dev instance:



find_real_file.png



and it worked.


Thank you so much   for the help on this.



it works when i do Try it within the cat item but its not working on the portal using the same cat item.....



Any thoughts?



Justin


Make the UI Type = ALL (or Both, depending on your version) then try it.