Hello LF Community,
I have an interesting situation that I'm not sure what's the reason of it.
We have a form that creates invoices for certain clients. These clients have a database of codes,descriptions,costs for each line of the invoice. The form is user friendly for our employees as they just need to enter the charges in a casual way rather than knowing the code and description that the client wants to see on the invoice. Thats being handled after the form submission in workflows with many conditional sequences.
That's been said, there is a preview function in the form that when user enter the charges, they were able to see what the invoice will look like after waiting a bit. The invoice page would be created after running in workflows, entry id of the invoice page would be assigned to a field on the form then it would show itself on a different tab on the browser. The user don't need to submit the form at this point and their form task would be open still on its on tab. This logic was working fine for years but it suddenly stopped working.
See the javascript code and the attached pictures.
Now what happens is, when user click on preview button, the form goes in to loading then eventually dissappears. The user sees the inbox on the browser. After a while when they keep refreshing the page, they see their task again and when they click on the task link, the invoice appears on the different tab, now they can review and go back to their form and submit it.
It almost like processing time is increased and the form doesn't stay open. The preview function became inconvenient and I'm not sure how to handle that.I'm not much of a coder and getting this done was a big hassle before. Do I need to add or change anything on the code? Any ideas or suggestions would be greatly appreciated.
We use laserfiche 11 and this is on classic form designer.
Thank you everyone!
The Preview Code:
// Preview open new tab logic
var previewEntry = $("#q161 input").val();
var link = "https://sjlf1v.pfcollins.net/laserfiche/DocView.aspx?db=PFC&docid=";
if (previewEntry.length > 1){
var fullLink = link + previewEntry;
download(fullLink);
}
// Function to open new tab and check if it was blocked
function download(link){
var popout = window.open(link);
if (checkPopup(popout)) {
popout.focus();
}
}
// Function to check if popup was blocked and show dialog if it was
function checkPopup(window){
if (!window || window.closed || typeof window.closed == 'undefined') {
$("#dialog").dialog({
width: 700
});
return false;
}
return true;
}
});