Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.

Moderator: amosbatto

Forum rules: Please search to see if a question has already asked before creating a new topic. Please don't post the same question in multiple forums.
By skhaitan
#824407
Hi, I have integrated Docusign Embedded signing into Processmaker Portal (developed to use REST API) using iframe. So users are able to sign documents within an iframe and redirects to URL that says "Thank you for signing. ".
1.png
1.png (59.87 KiB) Viewed 1003 times
2.png
2.png (45.26 KiB) Viewed 1003 times
Below the iframe, there is a "continue after Signing" button. This should be disabled till the signing completes and enabled so that we can complete the task.

Or is there a way to auto complete the current task once the user is redirected to page "Thankyou for signing" so that the button can be removed ?



Please guide.
User avatar
By amosbatto
#824419
This is really a question for DocuSign, so you should ask them.

Unfortunately, I don't have DocuSign, so I can't test this, but in theory you use a JavaScript polling function to check if the user has signed the document and then display the button. If you are displaying the DocuSign inside an iframe in a panel in your Dynaform, then you use your web browser's debugger to discover the ID of the "Continue after signing" button. Then you can use JavaScript to hide the button when the iframe's URL is loaded. Then, you can set up a polling function to check if the user has signed and redisplay the button.

I imagine that the code would be something like this:
Code: Select all
//hide button when iframe loads URL:
$('#yourFrameID').load(function() {
   $('#yourFrameID').contents().find('buttonID').hide();

   //polling function to check if user signed document and redisplay button:
   function checkIfSigned() {
     if ($('#yourFrameID').contents().find('*:contains("Thankyou for Signing the Document")').length > 0)) {
        $('#yourFrameID').contents().find('buttonID').show();
     }
   }
   setInterval(checkIfSigned, 2000); //execute every 2 seconds
});
Change yourFrameID to the ID of your iframe and buttonID to the ID that you find in the HTML code with the debugger.

Searching for text with contains() is inefficient and the text in the HTML has to be exactly "Thankyou for Signing the Document" for this to work, so it is better to see if DocuSign uses an ID or class that you can search for. Anyway, that gives you a rough idea where to start.

By the way, if you are client, have you asked the support team?
By skhaitan
#824427
Hi, It worked.. Thanks a lot.

I did contact docu Sign but they said we can redirect to any external site. So i wanted a way to complete current task using external php program so that when it gets reirected, the task gets completed.. but your javascript solution worked perfectly as expected. Thankyou again!
User avatar
By amosbatto
#824444
Glad that it worked. Can you post the exact code that you used?
I want to put it on the pmusers.com wiki.

Hi Amosbatto. I apologise, I have been away for w[…]

Export grid to excel or csv

I want to export a grid to any kind of excel or cs[…]

Custom inbox columns

Can we add a variable from a process as a column w[…]

Hi, I'm programming a case in which a logged-in us[…]