- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2024 07:48 PM
Hi,
I am trying to fetch a value from the JSON payload and trying it to push it to a Selectbox variable as choices by using g_form,addOption but it's returing as [object] [object] or [Null]
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2024 08:07 PM - edited 04-11-2024 08:08 PM
Thanks, so option variable in your example represents an object. You need to instead pass a string to addOption. It depends on what you want your dropdown list to display exactly. For example, if you want just the name displayed it would be option.name:
g_form.addOption('variablename', option.name, option.name, index + 1);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2024 07:51 PM
Can you please share the code you're using? [object Object] normally means you're trying to convert an object into a string (most likely unintentionally).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2024 07:59 PM - edited 04-11-2024 08:01 PM
Hi Nick,
SI:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2024 08:07 PM - edited 04-11-2024 08:08 PM
Thanks, so option variable in your example represents an object. You need to instead pass a string to addOption. It depends on what you want your dropdown list to display exactly. For example, if you want just the name displayed it would be option.name:
g_form.addOption('variablename', option.name, option.name, index + 1);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2024 08:17 PM
Thanks a lot.
That worked.