Solved

Rule dont apply after update value with javascript

  • 23 March 2015
  • 4 replies
  • 203 views

Badge +6

Hi,

 

I use javascript to update a value of a textfield (txtStepID) in my Nintex Form. There are several formatting rules on different controls triggered on this value. Since upgrading to nintex Form from V 2.4.0.0 to 2.5.0.0 the rule is not recognized anymore. I see the value changes due to the step but the rule just don't fire. If I change the field value manually in the textbox the rule is working perfectly.

 

Here is the javascript I use to update my textbox value:

function goNext() {

    var txtStep = NWF$("#" + txtStepID);

    var stepNumber = txtStep.val();

    stepNumber++;

    goStep(stepNumber);

}

function goPrev() {

    var txtStep = NWF$("#" + txtStepID);

    var stepNumber = txtStep.val();

    stepNumber--;

    goStep(stepNumber);

}

function goStep(stepNumber) {

    var txtStep = NWF$("#" + txtStepID);

    txtStep.val(stepNumber);

    txtStep.trigger("change");

}

icon

Best answer by rm 23 March 2015, 17:56

View original

4 replies

Badge +6

Found it:

...Since V 2.5.x.x Nintex Forms is triggering rule events onblur instead onchange

Therefore I had to change my code as follows:

txtStep.trigger("blur");

Badge +3

This perfectly works. Thanks Roman Mellenberger

Cheers

Pramod

Badge +11

May I ask what this script does?

I fail to reproduce the same ...

maybe screenshots (before / after) would provide more information

Hey Bimi82,


 


I searched for this issue after noticing rules weren't running after I was updating a field value with JavaScript.  When changing the field value manually on the form the rules did work so I knew something wasn't refreshing/triggering.  My original (and simple 🙂 ) code was:


 



function navButtonClicked(n) {

    NWF$('#' + js_navButtonSelection).val(n);

}


 


As per the instructions here I added the '.trigger("blur");' and it worked great!  The field was being populated with the new value and the rules ran properly (in my case showing/hiding sections).


 



function navButtonClicked(n) {

    NWF$('#' + js_navButtonSelection).val(n);

    NWF$('#' + js_navButtonSelection).trigger("blur");

}

Reply