Skip to main content

I am looking to set field values via button javascript click events.  I also have rules based on those field values. I can set the values but the rules aren't running.

Also how about hiding panels via javascript?

What about determining the form state (new, view, edit) in javascript?

It would be great if there was a document that documented the NWF JavaScript library.

Hello Matt Bezanson​ – I see a number of questions above, but I'll take a shot on a few. Are you using Nintex Forms for on-prem or O365?

Regarding your rules not running:

When you modify a control's value through JavaScript, a "change" event doesn't occur like it would if you had manually typed or clicked that field. I would try manually triggering this change event after you've set your field's value.

NWF$(".testField").val(25);

NWF$(".testField").trigger('change');


Regarding how to determine the form state in JavaScript – take a look at my answer here : Remove Add attachment option in edit mode

As you can see, you can use the form's URL query parameter for mode to perform JS functions based on a specific state:

NWF$().ready(function() {

  // if the form is in edit mode (mode=1)

  if (window.location.href.indexOf("mode=1") !== -1) {

    // do something here

  }

});


Thanks, I am using Forms On-Prem.

I did try the approach you mentioned, what I didn't like is the trigger call was was causing my entire page to refresh when panels were being shown or hidden.

When I changed the text box manually, the panels the transitions did not result in a whole page refresh.


Reply