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

Discussion

Discussion

Prevent Lookup from Running On Page Load

posted on November 19, 2019

Hi Everyone,

Our form has several methods that get triggered on "onlookupcomplete" event, which is a custom JS event listener that runs whenever a lookup is complete. One of those methods displays an error message when no results were returned by the lookup. The problem is that Form seems to trigger lookup when the page initially loads so we get this message by default. I want lookup to run only when the user actually triggers a lookup (i.e. click on autofill). Does anyone know how to get around this issue? 

 

Thank you in advance!

0 0
replied on November 19, 2019 Show version history

You could have it assign the lookupcomplete event when the onloadlookupfinished event is triggered instead of as soon as the form loads; I do that on a few of my forms where I run a few functions before I want the lookup events to be assigned/triggered.

$(document).ready(function(){
  // assign handler to detect onload lookup
  $(document).on("onloadlookupfinished", function () {
     // assign lookupcomplete handler after load lookup finishes
     $(document).on("lookupcomplete",function(event) {
       // your lookup event code here
     });
  });
});

 

1 0
replied on November 19, 2019

Makes perfect sense - thanks for the idea!

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

Sign in to reply to this post.