Expand my Community achievements bar.

SOLVED

How to check if a form has been signed

Avatar

Level 7

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

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

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

View solution in original post

17 Replies

Avatar

Former Community Member

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

Avatar

Level 7

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

Avatar

Former Community Member

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

Avatar

Level 7

I am sure this will require a Digital Signatures license ?

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

Aditya

Avatar

Former Community Member

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

Avatar

Level 7

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 !!

Avatar

Former Community Member

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

Avatar

Level 7

Thank you for your help so far.

Aditya

Avatar

Level 7

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

Avatar

Former Community Member

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

Avatar

Level 7

Steve - The issue is the user is submitting the form by email. I already have included a "submit by email" button which checks the status of the signature and attaches the pdf when successful. The downside to this is that they can save the form and attach it manually.

That's why I would like the workflow to check if the form has been signed. Is there a way to trigger an event in the form on the server side ? This way I can check the status of the signature field.

Aditya

Avatar

Correct answer by
Former Community Member

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

Avatar

Level 7

Genius !! Genius !! Genius !!

Will this event break the Signature ? Is there a way to prevent it ?

I have been looking for this solution over six months now. I really can't thank you enough.

Aditya

Avatar

Level 1

Hello,

I have tried one solution for validating signature if it is signed or not, and it worked fine at my end.

Take a textbox control(TextField1) and set invisible. Set this textbox in "Lock fields after signing" for the signature field.

So it will lock(readonly) the textbox if signature field is signed. It will set unlock(open) the textbox if you have not signed or clear the signature.

Now you can check the access property of TextField1. like: if(TextField1.access=="open"), it means signature field is not signed and you can show the message to sign the document.

I had two signature fields in one page and did the same for each signature field. it is working fine.

Regards,

Manoj

Avatar

Level 1

How know if a document is signed with Delphi?
I've AcroPDF ...
Which property must read?

Avatar

Level 1

Hi,

Need help on adobe form scenario as i have not worked before.

  1. Follow up action will be configured after digital signature is successfully applied to send the signed pdf to ALL path RECEIVED folder.

is this scenario possible, could you please help

Avatar

Level 1

This is old but to put this out in the ether because I was looking for a solution and found the answer after testing. To save time and not to have invisible fields. The signature box will return a value of <<dict>> so you can just check to see the the signature form returns this value when you check it. If not it's not signed. Well it has worked for me so far fine.

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----