Iterate through options of dropdown
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2024 10:17 AM
Hi everyone! I want to iterate through all the options in an existing dropdown/select box. I'm thinking I can do that using
The options array is empty even though the select box variable has multiple question choices tied to it that I'm able to view and select on the form UI. In addition, calling g_form.getElement('request_type') returns undefined.
I'm not sure if I'm calling these methods wrong. Later in my code, I do set the value of the same dropdown element using g_form.setValue('request_type', value) and it does successfully update the dropdown with what I want so I am using the right field name. Does anyone know what I'm doing wrong here? Is my expectation for the output of getControl incorrect?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2025 06:40 AM
Did you manage to find out anyhting about this? I'm having the same problem
best regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2025 06:46 AM
I ended up having to create a script include to query the question_choice table with the variable sys_id and the parameter. Then use a GlideAjax call in your client script to call this script include to ultimately grab all the options of the dropdown variable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2025 02:40 AM
Thanks very much for your reply. I almost thought that's what you came up with. I hoped there is a solution without making a trip to the server.
Best regards