How to check if a form has been signed | Adobe Higher Education
Skip to main content
Level 7
May 13, 2009
Répondu

How to check if a form has been signed

I have a workflow which initially checks if the document has been signed or not. However, my functionality doesn't seem to work.

We are using self signed digital signatures to sign PDFs. I would like to know what would be the best way to check if a form has been signed  ?

Thank you in advance.

Aditya

Ce sujet a été fermé aux réponses.
Meilleure réponse par

Aditya

I think I may have a solution...

1)  Add a hidden field to store a flag value

2)  Set it's default value to "Not signed" (this way, if the user manually attaches the form with out signing the falg is already set, indicating the signature is missing)

3)  On the "Change" event of the Signature field, add the following JavaScript

var oState = event.target.getField("form1[0].#subform[0].SignatureField1[0]").signatureInfo().status; // Get the current field's signed state.
if (oState == 0) {
    flagField.rawValue = "Not signed";
} else {
    flagField.rawValue = "signed";
}

The above script changes the flag field value to "signed" once the blank signature field is signed (because the Change event is fired).  If the user clears the signature field, the "Change" event is fired again and the flag field value is set back to "Not signed"

4)  Have your workflow process parse the data looking for the flag field value of "signed" or "Not signed" and have the process take the appropriate action based on the flag value.

Regards

Steve

16 commentaires

May 13, 2009

You noted that your functionality to determine if a PDF is signed is not working.  What method\operation are you currently using to determine if a PDF has been signed?

Regards

Steve

Aditya_S_Auteur
Level 7
May 13, 2009

I have a button over the signature field which validates the required fields and allows the user to sign.

I have an invisible field (flag) which is given a value of 99 when the the form has been signed. This action happens when the button successfully validates the required fields. I cannot use the post sign/pre sign event as it is not compatible with pre reader 9.0.

This way, when the user clicks the button it flag the field with 99 and the form may not be signed, the workflow checks for the flag value considers it signed. I know this is not the most efficient method, but I couldn't think of any other way.


Aditya

May 13, 2009

Aditya

You can add a "Verify PDF Signature" operation to your process.  This operation throws a "Signature Field Not Signed Exception" when attempting to validate an empty signature field.  You could have your process then do something when this exception occurs.

The "Verify PDF Signature" operation requires the name of the signature fiels as a property, if you know the signature field object name, then you could hard code this.  If not, you can use the "Get Signature Field List" operation to query the form for all of the signature field object names on a form.

If your form has more than one signature field you will need to include a loop in your process to chech each of the signature fields for a signature.

Hope this helps.

Steve

Aditya_S_Auteur
Level 7
May 13, 2009

I am sure this will require a Digital Signatures license ?

We haven't purchased one yet... Is there any other alternative ?

Aditya

May 13, 2009

Aditya

The operations I referenced are part of Digital Signatures ES.

You could use the following JavaScript to check the status of a signature field (assuming you are using an XFA based PDF form). I tested the following script on a button click event and it works properly.

// Get the signature fields signed state.

var oSigState = event.target.getField("form1[0].#subform[0].SignatureField1[0]").signatureInfo().status;
if (oSigState == 0) {
    app.alert("The Signature is missing");
}

You would need to determine the correct SOM expression for your form design.  (i.e. "form1[0].#subform[0].SignatureField1[0]")

Regards

Steve

Aditya_S_Auteur
Level 7
May 13, 2009

This what I was looking for.

When would I do this check in the form ? How would I make the workflow check this ?

Thank you Sir !!

May 13, 2009

Aditya

The script I showed you is part of the form, so ideally you would prevent the submission of the form unless the signature field was signed as opposed to the workflow process checking for the signature once it receives the form.

To prevent the submission, you could add a regular button to your form along with a "Submit" button.  Hide the real submit button, and add logic to the "regular" button that checks if the signature field is signed, if it is...  execute the "Click" event of the hidden submit button, otherwise do something else (i.e. tell the user to sign the PDF)

The only way the worflow process could check this (assuming you are not using Digital Signatures ES) would be to check some flag value in the form data (like you were trying originally).

Regards

Steve

Aditya_S_Auteur
Level 7
May 13, 2009

Thank you for your help so far.

Aditya

Aditya_S_Auteur
Level 7
May 13, 2009

I had one more question. I have created the flag for the signature status however, I am unable to find the correct event to get the status of the signature and save the form without breaking the signature status....

Can you help me with this too ?

As an alternative, is it possible to retreive some kind of hash value ? I am sure the signature field (once signed) leave some kind of value in the form's XML structure ..

Aditya

May 14, 2009

Aditya

Is there a specific reason why you want\need the workflow process to check for the signature?

As I stated earlier, I believe the best method is to prevent the submission of the form unless the signature field was signed.  This eliminates the need to set a flag on the form, to have the workflow check for that flag, and prevents the modification of a signed PDF which will affect the status of the digital signature.

Regards

Steve