0

I integrated the EchoSign API in the website using PHP and i got stucked with the callback information.

I am creating a widget and displaying to the user and i want after the user click the button and document is signed i need to return the result as document is signed or not that i can move user to the next step.

Below is my code:

require_once($_SERVER["DOCUMENT_ROOT"]."setup.php");

global $result_sign;

    $recipient_email = $_SESSION['EchoSign_Email_Document'];

    $md5pdf_echosign = md5($_SESSION['EchoSign_Email_Document']) . ".pdf";

    $filepath = $_SERVER["DOCUMENT_ROOT"].'/path_to_file/'.$md5pdf_echosign;
    $file = EchoSign\Info\FileInfo::createFromFile($filepath);
    $widget = new EchoSign\Info\WidgetCreationInfo('Agreement', $file);
    $personalization = new EchoSign\Info\WidgetPersonalizationInfo($recipient_email);

    try{
        $result_sign = $api->createPersonalEmbeddedWidget($widget, $personalization);
    }catch(Exception $e){
        print '<h3>An exception occurred:</h3>';
        var_dump($e);
    }

and like this i display the result

echo $result_sign->{'embeddedWidgetCreationResult'}->javascript;

i call the file using AJAX like this:

$('#echosign_id').html('my_ecosign_file.php');

I will appreciate any help.

I want that after user sign document i want to find out that document is signed and check if is signed move user to the next step.

My JS:

function FormSubmitBindStep4(){
    $('#FormID input#input_id').unbind('click').bind('click', function(){


        var obj = $(this);
        $('.prior_dark_form_preloader').remove();
        obj.hide();
        $('.prior_form_error_input').removeClass('prior_form_error_input');
        $('#terms_1-styler .jq-checkbox__div.error_input').removeClass('form_error_input');
        $('#terms_2-styler .jq-checkbox__div.error_input').removeClass('form_error_input');
        $('#3-styler .jq-checkbox__div.error_input').removeClass('form_error_input');
        $('#4-styler .jq-checkbox__div.error_input').removeClass('form_error_input');
        $('#5-styler .jq-checkbox__div.error_input').removeClass('form_error_input');
        $('#6-styler .jq-checkbox__div.error_input').removeClass('form_error_input');
        $('#7-styler .jq-checkbox__div.error_input').removeClass('form_error_input');
        $('#confirmation_1-styler .jq-checkbox__div.error_input').removeClass('form_error_input');
        $('#confirmation_2-styler .jq-checkbox__div.error_input').removeClass('form_error_input');
        $('#confirmation_3-styler .jq-checkbox__div.error_input').removeClass('form_error_input');
        $('#confirmation_4-styler .jq-checkbox__div.error_input').removeClass('form_error_input');

        $('<img src="/preloader.GIF" class="prior_dark_form_preloader"/>').insertAfter(obj);

        $(document).scrollTop(0, 1000);

       if (actualStep < 4){
           actualStep = 4;
       }

        $.ajax ({
            type: "POST",
            url: "/form_step_4.php",
            data: { json: createJsonFromForm('FormIDStepValidation') }
        }).done(function(data) {
            $('.prior_dark_form_preloader').remove();

            if (data == true){

                $('#FormID').html('<iframe scrolling="no" src="/EchoSign.php" width="1150px" height="715px">',function(){

                });

            }else{
                console.log("step 4", "incorrect");
                obj.show();
                $('.prior_form_error_input_anchor_php').remove();

                var errors = jQuery.parseJSON(data);
                for(error in errors){
                    Step1Validation(error, true, errors);
                    Step2Validation(error, true, errors);
                    Step4Validation(error, false, errors);
                }
                $( 'input' ).click(function() {
                    $(".input_anchor_php").hide();
                });
            }
        });
        return false;
    });
}

Thanks.

aaa
  • 446
  • 2
  • 8
  • 29
  • Unless you're using some plugin you haven't spoken of, jQuery's [`.html()`](http://api.jquery.com/html/) method does not use ajax, nor does it accept a url as a parameter. – Daedalus Aug 04 '14 at 09:06
  • @Daedalus actually i have a fomr in ajax with 4 steps, and i load that php file with the signature after the 4th step, the widget is laoding and user can sign the document, but i do not know how to find the result when the document was signed... – aaa Aug 04 '14 at 09:25
  • The above is not ajax. Show your js. – Daedalus Aug 04 '14 at 22:21
  • @Daedalus actually my form is in ajax, but what i have about this echosign is just that line that i just call and load the file inside, i do not have anything else in ajax about echosign because i can not figure out how to get a result of my widget... – aaa Aug 05 '14 at 07:49
  • Your question, as it stands, is unclear. Without all your code, your clear, intended goal, what you expect to see and what you're getting instead, this problem is unsolvable. – Daedalus Aug 05 '14 at 07:52
  • @Daedalus Above is all the source code for the echosign api, what actually i need i need in php somehow to get the status of the widget like documentsigned = yes or no and after that i will do in ajax, i do not know how i can get this in php documentsigned = yes or no – aaa Aug 05 '14 at 10:18
  • You haven't stated what you're getting instead. We need that information. – Daedalus Aug 05 '14 at 20:18
  • With the code from above i load the echosign file that is displaying the widget and alow me to sign the pdf document and sending on my email the document, what i need to add in my php code a repsonse from echosign to knoe when the document was actually signed, for example to get something OK, that i can use foward ajax and move user to next step, at this step everything is woking as expected but i am confused about to get in my php the response of my widget when document is signed... @Daedalus – aaa Aug 06 '14 at 08:28
  • I stated what we need. If you're unwilling to provide that, I'm unwilling to help. – Daedalus Aug 06 '14 at 08:37
  • @Daedalus Please see my js code, i added the full code. Thanks – aaa Aug 06 '14 at 09:48
  • This will be the last time I'm going to try getting this information: **What are you getting instead of your desired result?** – Daedalus Aug 06 '14 at 20:48
  • @Daedalus hi, i am trying to explain you but seems i do not explain enough, at this point what i have is ok, document is signed and everything is working, after the document is signed i do not get anything, because i didnt setup any callback, my problem is how to setup the callback to retrieve the result when document is signed, do u understand what i mean? Thanking you in advance.... The adbe gave me this one but i do not know how to use https://www.acme.com/echosign/monitor.php – aaa Aug 07 '14 at 06:48

0 Answers0