Using the Signature Pad in Custom Forms Example

Having been ask numerous times on how to implement getting signatures in custom forms I put together an example encounter form to show how to use the feature. Attached below.

signature_form.zip (1.1 KB)

Unzip in openemr/forms and register as any other form to test it out. Otherwise check out the new.php code.

The signature pad can be implemented in LBF’s and portal templates also using the appropriate directives in either.

Any questions feel free to post them here.

Some screenshots.

2 Likes

Capturing physical signature feels archaic but probably meets the requirements. There must be a product that is able to prove someone/something and they alone checked this box (or entered a specific code) when they were accessing this application with a given authentication scheme.

Is there any standard for using electronic signature? Have seen so many records from other EMRs printed that just say “Electronically signed by …” without any visible signature tokens.

1 Like

You’re correct @mdsupport
Generally a disclaimer with a date stamp is acceptable.
In the U.S I’ve noted one hardly ever script signs anything unless on paper.

Still there are many that only trust a signature.

1 Like

@sjpadgett , first of all thank you very much for making this implementation available.

The signature works and saves correctly. However, the signature does not appear when i try editing the form.

Is that an expected behavior or i did something wrong?

I believe the reason an actual signature is necessary, is that anyone can push a button on behalf of another. In a court of law, signature comparisons could not be done.

I think eventually we will be able to figure it out in health care, however, we are still in diapers in that regard. It’s all about liability, I think.

The banking industry is more advanced than we are, and, if I am not mistaken, they still use handwritten signatures and notaries.

Technically, in the pre-op, for example, we would need to have identification for the hardware, the signer, and the witnesses. I mean, for surgical consents, for example.

1 Like

You have to save the image to your form table so it may be retrieved for edit and reports etc…
To set:

<input type="hidden" id="patient_signature" name="patient_signature" value="" />
<input type="hidden" id="admin_signature" name="admin_signature" value="" />
<input type="hidden" id="witness_signature" name="witness_signature" value="" />
<img class="signature" id="patientSignature" style="cursor:pointer;color:red;height:65px;width:auto;" data-type="patient-signature" data-action="fetch_signature" alt="<?php echo xla("Click in signature"); ?>" data-pid="<?php echo attr((int)$pid); ?>" data-user="<?php echo attr($user); ?>" src="<?php echo $retrieved_image_from_db; ?>">

To save you can add hidden input tags and populate their values with image data from img tag id/name on post using javaScript onsubmit event, grabbing img src and add to hidden input value.

Also note Kofi that Brady is implementing using encounter forms in portal here: https://github.com/openemr/openemr/pull/5530

You know what? In my XAMPP test server, the Save button does not show up.
Could that be the problem? there is no way to save the form
Also, Jerry, I think you have a type above. The file gets saved to openemr/interface/forms, no?

I might have messed up the installation, let me try again!

I didn’t implement the full form such as view/edit or save and fetch. I left that and hoped devs can figure out how to do all that. The question was how to add signature to forms.

1 Like

Ah, ok, thanks. I can maybe look into that. I created these forms before!

Thank you :sparkling_heart:

You mean I even get a sparkling heart when I disappoint!

Jerry, you never disappoint!

1 Like

Hello @sjpadgett ,

It works. I got the value from <img src="" /> and saved. I am able to retrieve and display the signature. Many thanks

2 Likes

Glad you got it Kofi. I knew you would. Once you get the hang of encounter forms, they become fun to develop.

1 Like

Hello @jerry,

I am having a problem. Once i sign the form and save it in the database, the signature doesnt show up. Please find the image below.

and the code,

<img class="signature" id="adminSignature" style="cursor:pointer;color:red;height:65px;width:auto;" 
            data-type="admin-signature" data-action="fetch_signature" alt="<?php echo xla("Click in signature"); ?>" 
            data-pid="<?php echo attr((int)$pid); ?>" data-user="<?php echo attr($user); ?>" 
            src="<?php echo $obj["signature"]?>"
            >

Thanks in advance!

Fixed!

The solution was to change the database field type from text to mediumtext.

After, i cleared my cache, signed a new form and it shows up.

I am using OpenEMR with patch [7-0-0-Patch-2.]

The signature field works great in my form, displays perfectly. The issue I have is that when you print to PDF it does not read the image into the PDF.

Is there a solution to this?

hi @J_R,

are you using it as an encounter form? If yes, it works fine in my case.

There’s one known issue when the portal templates do not show the signed signature on PDF.
That hasn’t been fixed yet.

Hi Kofi, Thanks for responding my form has a category of ‘Clinical’ and is selectable in an encounter, if that makes sense.

I fixed this and posted links here Adding Patient Portal Document Templates to OpenEMR Patient Documents - #22 by sjpadgett

1 Like

Thank you, I will upload the php files and let you know how it goes. Whilst it is a steep learning curve, I am loving OpenEMR and the community