Issue with lookup change event firing on form load - Nintex forms version 2.7


Badge +2

Hi there Nintex community,

 

I am having an issue with the Nintex forms lookup list controls change event handler, whereby the event handler is firing as the form is loading. The handler have alerts that are displayed are fired on change of the selected item, so these are being show as the form is loading, which is not good

 

I searched the Nintex forums for the issue and found a couple of posts indicating that in newer version of Nintex Forms, the lookup control has been changed to load data asynchronous after page loaded. So based on this I moved the registration of the handler to NWF.FormFiller.Events.RegisterAfterReady. I also added;

 

NWF.FormFiller.Events.RegisterAfterReady(function () {

 

 

 

    var EngagementType = NWF$('#' + ddlEngagementType);

    EngagementType.change(function (e) {

        if (e.originalEvent!=undefined){

            if (EngagementType.val()!="")

            {

                alert("Engagement type changed");

            }

 

I also read in a post that the lookup change event fires (ie when data fetched and populated, it's a change), you check if it is triggered by forms or human (using e.originalEvent check), and if value is empty (means the Please Select... on dropdown list type lookup). So I added these conditions to the events register on change.

 

However, the alert is still firing when the form is launched in edit mode. In fact, the change event is fired 3 times when the form is loaded in edit mode;

 

1) EngagementType.val is "" and e.originalEvent id defined

2) EngagementType.val is "13" and e.originalEvent id defined (alert displayed)

3) EngagementType.val is "13" and e.originalEvent id undefined

 

I really need the change event registered after the form lookup control has been loaded with data and selected value set by the form load. Alternatively is there a way to check if the event is initiated by the user or the form, as the value of e.originalEvent is actually defined for the first 2 calls as above.

 

Can anyone provide some insight to this issue?

 

Thanks,


11 replies

Badge +4

Dear Scott,

We have received your email here in Support. We will investigate your enquiry and be in touch via email very soon.

Badge +8

Hello,

I just noticed the same with Nintex Forms 2.9.0.0.

As a workaround, I am investigating using JavaScript which looks promising.

Badge +6

Any updates on this?

Badge +2

We contacted Nintex support and were advised that there was a known issue with the onchange event for the Lookup lists. The Lookup control populates and has the selected value set asynchronously after the form is loaded. They suggested as a workaround that we import the legacy List Lookup and then use List Lookup V1 control on the forms until the issue is addressed.

So using List Lookup V1 fixed the issue. The legacy list lookup V1 and current list lookup can both be used on a form.

I can post the steps used to import the legacy lookup if needed.

Cheers,

Scott.

Userlevel 5
Badge +12

Hey Scott Willis,

I remember the old List Lookup having a "page reload" occur when used in a "cascading" manner with other list lookup controls.   You might want to make sure you won't be affected by this (or at very least it doesn't bother you) if you are going to use it. 

Thanks,

mike

Userlevel 5
Badge +14

Scott Willis​, is lookup V1 be compatible with other NINTEX controls resp functionality?

I mean, apart from placing it on the form and connecting it to a list field, can you eg. reference lookup V1 control in rules or formulas?

from my experience nintex just allows to place sharepoint native controls on the form and that's all.  if one need to relate them to nintex ones, it's really a pain.

however, I haven't worked with lookup V1, so I'm just curios.

Badge +2

Hi Frank,

Nintex Support sent me the following to import the legacy List Lookup;

1.      On the Central Administration home page, click Nintex Forms Management.

2.      On the Nintex Forms Management page, click Manage Form Controls.

3.      Under the Form Control Types table, in the Import text box, enter the following text:

Nintex.Forms.SharePoint.FormControls.SharePointLookupFormControlV1, Nintex.Forms.SharePoint, Version=1.0.0.0, Culture=neutral,PublicKeyToken=c52d764dcf7ec883

4.      Click Import.

Cheers,

Scott

Badge +2

Mike,

Yes, you are correct, List Lookup V1 does have a "page reload" occur when used in a "cascading" manner. So I didn't use it on the cascading lists. Fortunately the cascading lists did not have any "obvious" onchange events that fired on page load.

Scott

Badge +2

Hi Marian,

Yes, lookup V1 is compatible with other NINTEX controls resp functionality. Also you can have both V1 controls and the current Lookup list controls on the same form. You can reference lookup V1 control in rules or formulas as per the other controls.

The only issue is with List Lookup V1 and cascading lookups. If you use them in a cascading manner the onchange event causes an annoying page reload. So I just replaced my non-cascading lookups that had onchange events that fired alerts with the List Lookup V1 controls.

I hope this helps.

Scott.

Userlevel 5
Badge +14

thanks for clarifying, Scott Willis

Badge +4

Any news on this?

Reply