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

Question

Question

Unexpected javascript behavior after Forms upgrade to 10.4.5.282

asked on October 28, 2020

Last week we upgraded our Forms from 10.4.1 to 10.4.5.282 and one of our forms that was making use of the following javascript didn't work as it did before the upgrade.

$(document).on("lookupcomplete", function (event) {
  if(event.ruleId=="3354"){
   LF.lookup.autoPopulate();
  }
});

$(document).on("lookupcomplete", function (event) {
  if(event.ruleId=="3357"){
  LF.lookup.autoPopulate();
  }
});

Is this function no longer supported? 

I'm not a javascript engineer and we got this snippet from this post and form was working fine previous to the upgrade.

If I remove this javascript from the form, the form works but no longer allows me to select another value from a drop down after it has been autofilled, which I could before.

0 0

Replies

replied on October 28, 2020 Show version history

I am uncertain if support for this was removed - I doubt it.

Most likely your rule ID has changed because of the upgrade.

$(document).on("lookupcomplete", function (event) {
//Add this
console.log(event.ruleId);
  if(event.ruleId=="3354"){
   LF.lookup.autoPopulate();
  }
});

$(document).on("lookupcomplete", function (event) {
  if(event.ruleId=="3357"){
  LF.lookup.autoPopulate();
  }
});

Add the line I commented out above and see what the new rule ID is when the lookup has finished.

Then simply replace the ruleId with the new one.

1.) Open browser

2.) Go to preview

3.) Press F12

4.) Get new ruleId

5.) Amend code

This SHOULD work.

Good luck!

3 0
replied on October 28, 2020

This client did advise that they verified the Rule IDs did not change with the update

1 0
replied on October 28, 2020 Show version history

I agree that the most likely issue is the ruleId's have changed.  You should probably look into using the event.triggerId instead of the event.ruleId.  See reply by Xiuhong Xiang in Can we get a "lookups complete" custom event listener please?

Also, I would do a single $(document).on("lookupcomplete" block with an if - else if like this

$(document).on("lookupcomplete", function (event) {
  console.log(event.triggerId);
  if(event.triggerId=="lookup1"){
    LF.lookup.autoPopulate();
  } else if(event.triggerId=="Field1"){
    LF.lookup.autoPopulate();
  }
});

Note that you can use the console in the Dev Tools (F12) to see the triggerIds that triggered the lookup.

3 0
replied on October 28, 2020

The 10.4.4 release notes include this. "

1 0
replied on October 28, 2020 Show version history

Chuck, sorry but I don't really know javascript, so are you saying that I need to change the code I'm using?  

 

0 0
replied on October 28, 2020

This script does not contain any HTML closing tags (self-closing or regular) 

0 0
replied on October 28, 2020

This client has opened a case with us (Solution Provider) to further troubleshoot. I will update this case with our findings after we investigate.

 

What we know is...

This approach was designed around having 2 separate Lookup Rules, one to auto-populate, and the other to use the Lookup source values in a drop-down format. This JavaScript is intended to fire after the first Lookup completes (the auto-populate), to execute the second Lookup Rule (the functionality is, the field is auto-populated with a value, but allows submitters to click in the auto-populated field and get the drop-down to change the value, if necessary.

This functionality is explained in the post that they embedded in the original description of this post.

1 0
replied on October 28, 2020

We double checked following script with 10.4.5 using the sample from this post, it still works.

$(document).on("lookupcomplete", function (event) {
  if(event.ruleId=="17509"){
   LF.lookup.autoPopulate();
  }
});

Can you test with a simple form?

0 0
replied on October 29, 2020

I agree with @Xiuhong Xiang.

Now just also console.log it to triple check it is still behaving as anticipated.

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

Sign in to reply to this post.