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

Community Alums
Not applicable

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

 

12 REPLIES 12

Tanushree Doiph
Mega Guru

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

Community Alums
Not applicable

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.

 

Hemant Goldar
Mega Sage
Mega Sage

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

 

 

Adrian Ubeda
Mega Sage
Mega Sage

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, 

If it was helpful, please give positive feedback! ✔
☆ Community Rising Star 22, 23 & 24 ☆