Unable to set/clear value of a variable with "onChange" client script - "control" object - within a multi row variableset

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2020 12:18 AM
Hi,
I am unable to set/clear value of a variable with "onChange" client script - "control" object - within a multi row variableset. Is it a known issue Or anything wrong with my code or PDI?
See below code and attached screenshot.
g_form.setValue('u_age',''); // working
g_form.setValue(control,''); // not working
g_form.clearValue(control); // not working
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2020 12:23 AM
Hey,
write the exact name(backend name) of the control variable, is it 'control'?
g_form.setValue("field_name", "");
OR you can also use UI policy for that just check the clear field value in UI policy action
Thanks
Tanushree

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2020 12:42 AM
control is an object which is provided within "onChange" script. It's not user defined.
control within "onChange" script refers to the variable on which change action is getting performed. In my case it's u_age.
And I cannot use UI Action policy as there will be a situation where i want to just change the value of variable and not wipe out it's values.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2020 12:25 AM
Hi,
use single quotes and actual name.
g_form.setValue('control','');
g_form.clearValue('control');
Try this it works for me.
Please mark reply as Helpful/Correct, if applicable.
Kind Regards,
Hemant
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2020 12:27 AM
Hi,
If you want to set/clear value from variables which are a variable set you should use it as a single variable, you can't do it at once. You should do g_form.setValue('name_variable', value); for each value inside variable set you want to apply.
Apart from that, control parameters are generally used for If we want to change dynamically field size, length etc in ui page... Not setting/clear value.
If it was helpful, please give positive feedback.
Thanks,
☆ Community Rising Star 22, 23 & 24 ☆