Skip to main content
Nintex Community Menu Bar
Solved

Rule not being applied after setting a value with javascript

  • April 19, 2016
  • 4 replies
  • 161 views

Forum|alt.badge.img+3

Hi,

 

I'm setting a value in a field using JavaScript, and I have a rule that show some fields based on this value but the rule is not working.

Is there any way to enable the rule? It is like is not being refreshed. However it works if I type something in the field (I cannot do this because it will be hidden)

 

Regards,

Best answer by freerider38

Hi,

you have to say to your control to refresh :

Ex :

var control = NWF$("#" + varControlID);

control.val(value);

NWF.FormFiller.Functions.ProcessOnChange(control);

This works fine for input text

For choice field, i use :

control.trigger('change');

instead of ProcessOnChange

Regards,

4 replies

Forum|alt.badge.img+4
  • 21 replies
  • Answer
  • April 19, 2016

Hi,

you have to say to your control to refresh :

Ex :

var control = NWF$("#" + varControlID);

control.val(value);

NWF.FormFiller.Functions.ProcessOnChange(control);

This works fine for input text

For choice field, i use :

control.trigger('change');

instead of ProcessOnChange

Regards,


Forum|alt.badge.img+8
  • 210 replies
  • April 19, 2016

Hello Alicia Garcia​ – What you're experiencing is likely caused by the fact that manipulating a field through JavaScript doesn't trigger a change event in the same way that manual manipulation does.

Have you tried giving focus to and away from that field after it's been changed to force the rule to re-execute?


Forum|alt.badge.img+3
  • Author
  • 8 replies
  • April 19, 2016

Thanks, you saved me a lot of time.

Regards,

Alicia


Forum|alt.badge.img+3
  • Author
  • 8 replies
  • April 19, 2016

Thanks, previous answer worked for me.