You are viewing limited content. For full access, please sign in.

Question

Question

Forms 10.4 upgrade issues with onloadlookupfinished events.

asked on April 3, 2019

I recently upgraded from 10.3 to 10.4 and I started having issues with some forms with lookupstarted and onloadlookupfinished after the upgrade. 

 

The form starts a CSS loader (which works fine):

$(document).on('lookupstarted', function(event) {
        console.log("onloadlookupstarted event");
        $('#loader, .loader').show();
    });

 

and it turns off when there's a lookup finished (which works fine when it's called): 

$(document).on("onloadlookupfinished",function (event) {
        console.log("onloadlookupfinished event");        
        $('#loader, .loader').hide();

}

Since the upgrade, a 'lookupstarted' event doesn't seem to be 1:1 with an onloadlookupfinished. I'm not sure if it's something I'm doing wrong with my lookup rules, javascript, or a bug in 10.4. Wondering if anybody else is having this issue or has any insight.

It seems that if I only run a single lookup rule I get consistent onloadlookupfinished events:

with three lookups:

 ...however, once I start enabling a few more rules (there are 23 lookup rules total) I get a lot of lookupstarted events and no onloadlookupfinished events after the first event:

When I enable all 23 rules, a lot of onloadlookupstarted events and no finished events:

 

0 0

Answer

SELECTED ANSWER
replied on April 3, 2019 Show version history

It is worth noting that lookupstarted applies to individual lookup events and is not automatically triggered when the form loads.

On the other hand, onloadlookupfinished is a one-time event that only fires when the form is finished loading and never again.

The additional events evidenced by the console logs are not onload events, they are "lookupcomplete" events, so your code isn't being triggered.

Additionally, you should check the event.triggerId value so the lookupstarted event only shows the elements when a specific field lookup is started rather than all of them.

You could do the same with "lookupcomplete" and target the same field so that you always have a 1:1 each time that lookup fires even if it is after loading is complete.

0 0
replied on April 3, 2019

Thanks! That makes sense, not sure why it was working for me in 10.3- I will rework my code. 

0 0

Replies

You are not allowed to reply in this post.
You are not allowed to follow up in this post.

Sign in to reply to this post.