- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-08-2022 05:51 PM
Hello, I have this field in my form that has been dynamically added through a client script
My current problem is that it won't let me choose other choices, for example when I choose Medium or Large, it just reverts back to small automatically. This goes for other records in the table too.
Here is my script
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading) {
return;
}
if(newValue == ''){
g_form.clearOptions('u_choice_2');
}
var choice = g_form.getValue('u_choice_2');
var ref = g_form.getReference('u_reference_1', callBackMethod); // reference field name here
function callBackMethod(ref, choice){
//g_form.setValue('u_choice_5', 'Small - '+ref.small+' '+'Medium - '+ref.medium+' '+'Large - '+ref.large);
// give field name here
g_form.clearOptions('u_choice_2');
g_form.addOption('u_choice_2',ref.small ,'Small - '+ ref.small);
g_form.addOption('u_choice_2',ref.medium ,'Medium - '+ ref.medium);
g_form.addOption('u_choice_2',ref.large ,'Large - '+ ref.large);
}
}
Please help, I cannot figure out what is causing it.
Solved! Go to Solution.
- Labels:
-
Studio

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-08-2022 06:23 PM
Enable debugging and watch the field to see what client script / policy is causing the field change

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-08-2022 06:23 PM
Enable debugging and watch the field to see what client script / policy is causing the field change

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-08-2022 06:28 PM
Hi,
I'd recommend following Kieran's advice to learn how to troubleshoot.
However, just looking at your code, your callback function is clearing the choice field, then resupplying it with the 3 values...which, without a "none" is going to default to the first choice, which you have as small.
So you'd need to review your code and think through what you're trying to do. Why onChange would you be clearing all options, then adding all 3 back everytime that field changes value.
You're doing nothing with the "choice" parameter in your callback function.
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-10-2022 07:28 AM
Hi,
I'm glad you found a correct answer that works for you.
If you can, please let us know what resolved your issue as learning to troubleshoot it is great and of course the best way to learn and all that, but was it what I was mentioning above and pointed out?
Just wanted to check-in and see if my reply guided you appropriately?
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!