- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2019 08:18 AM
I have a client script running on a sc_request table.
The script will addOptions to a state field which is a dropdown based on certain conditions.
Adding the options based on the conditions work, however when they are added they appear as blue integer values once the record is saved. I add the options like so .....g_form.addOption('state', '97', 'Development Ready'); and when i select and save the record it appears as the 97 value in blue text when it should be Development Ready in just normal black text
Do i need to add these in a backend choice list / table somewhere? If I add it to the "selected" choice list then the dropdown choices are always present which i do not want as i need to add them dynamically through the client script with the addoptions.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2019 12:44 PM
10 seconds to load the client script is extremely poor performance. I'd evaluate what is running on that form load that is bogging it down. Perhaps setting the client script order could also help. Here is a good article on how to evaluate what is affecting the form load:
Debug slow performance on the client side using Chrome
Unfortunately for what you are trying to accomplish I think the only way is to utilize onLoad() & removeOption().

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2019 12:23 PM
The purpose is to manipulate client side data. Unfortunately choice lists like this one use server side data to populate the values thus adding it through client side does not fully work. If your requirement is to only show this field sometimes can you not add it to the choice list through the selector then use removeOption() to hide it when appropriate i.e on form load? This way server side will hold the proper values for reference if it ends up getting set.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2019 12:36 PM
Yes I have done the removeOption way, but the client script takes about 10 seconds to load to remove the options from the dropdown and a user can go in quickly and set the dropdown to a choice that should be getting removed.
It was a Onload client script so im trying to convert it to perform OnChange ...

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2019 12:44 PM
10 seconds to load the client script is extremely poor performance. I'd evaluate what is running on that form load that is bogging it down. Perhaps setting the client script order could also help. Here is a good article on how to evaluate what is affecting the form load:
Debug slow performance on the client side using Chrome
Unfortunately for what you are trying to accomplish I think the only way is to utilize onLoad() & removeOption().