Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable signaturePad (canvas) after ajax success

I am using this plugin.

My application submits signature with ajax call. On a succesful ajax return I want to disable any signature changes by user. The last thing I tried is a following, but the signature pad is still active and drawing lines (listeners afe not detached):

   function showResponse(itemJson, statusText, xhr, $form) {

    if (itemJson.status == 'success') {

        debugger;

        $($form.find('.clearButton')).remove();
        $($form.find('button')).remove();

        $form.find('input').attr('readonly', 'readonly');

        var api = $form.signaturePad();
        var sig = api.getSignatureString();

        api.updateOptions({displayOnly: true})
//        $form.signaturePad({displayOnly: true}).regenerate(sig);

    }
}

Does anyone know how to update existing signaturePad, so it turns into disabled mode ?

like image 912
vlr Avatar asked Oct 18 '22 22:10

vlr


1 Answers

Usually i use:

api.off();

It works in my software

like image 159
Fabio Ottaviani Avatar answered Nov 15 '22 10:11

Fabio Ottaviani