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

Question

Question

prevent submission till form fully loads

asked on November 14, 2022

We have a form implementation that is supposed to prevent a form from being submitted until it is fully loaded. The form is very lookup heavy, and some of the look ups have in the upwards of 20 or more records.  In the form javascript, there is " $(document).on("lookupcomplete", function (event)..."   and I cannot find a definition of this anywhere in the form javascript .  

Is this an inhouse method defined somewhere else? since it is supposed to be disabling the form until all the look ups complete, it would make sense (still doesn't work though) or is this the name the method and the form just isnt coded to do what was supposed to be delivered?

 

Any insight is appreciated. I am looking for other questions/responses for the best way to handle this scenario where a lookup driven by a stored proc needs to complete before the form can be submitted.

 

I have provided the portion of the method below - please note, the status method that is called checks the status and if closed, makes most elements on the page read only

$(document).on("lookupcomplete", function (event) {
  if (event.triggerId=='Field364') {
     $('#q365 select').val($('#q273 input').val());
    }
  Status();
 
  // Allow submitting
  $(".action-btn").prop('disabled', false);
});

 

0 0

Answer

SELECTED ANSWER
replied on November 14, 2022 Show version history

So you are disabling the action buttons in the document ready block, and then you want to re-enable it when the lookups are complete, but it isn't working out that way - do I have that right?

Have you tried using onloadlookupfinished instead of lookupcomplete?  lookupcomplete runs on lookups started by user input where onloadlookupfinished runs on lookups started by the form loading.  

$(document).on("onloadlookupfinished", function () {
  alert('Load Lookups are Complete!');
});

 

P.S. - use the "code" tag/button to make your code more readable in your posts/comments.

1 0

Replies

replied on November 15, 2022

Just as an FYI, I believe Forms 11 disables the action buttons until all initial lookups have completed.

2 0
replied on November 14, 2022 Show version history

I think you probably want to use this instead of lookupcomplete

 

$(document).on("onloadlookupfinished", function(event) { });

1 0
replied on November 15, 2022

Thanks for the quick response.  I have even added the pop up because the users are not always sure when the submit button is ready. This takes the guessing out of it. 

1 0
replied on November 15, 2022

It is also worth noting that in recent versions Laserfiche added built-in blocking of submission while lookups are actively running; this code should disable the Submit buttons automatically, so depending on your specific scenario and Forms version you may not need this anymore.

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

Sign in to reply to this post.