Community articleDeleteSignature function
Added by IBM contributorIBM on August 15, 2011
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

No abstract provided.


This function deletes the specified digital signature in the form. For security reasons, the form must meet certain criteria before this is allowed. None of the following should be locked by another signature: the signature, its descendants, the associated signature button, and its signer option. If these criteria are met, then the signature's locks are removed, the signature item is deleted, and the signer of the associated signature button is set to empty ("").


   Sub DeleteSignature(
      signatureItem As IFormNodeP)


Table 1. Function parameters
signatureItemIFormNodePThe signature node to delete. You can retrieve this node by calling DereferenceEx on the signature button.


Nothing if call is successful or throws an exception if an error occurs.


If the signatureItem item contains a layoutinfo option, DeleteSignature will not remove the entire signature from the form. Instead, the signature item and the layoutinfo option will remain. To completely delete the signature item, you must delete the remaining nodes manually by using Destroy to delete the signature item.


The following function checks to see the signature in the form is valid. First, the function uses DereferenceEx to locate the signature button. It then uses GetLiteralByRefEx to get the name of the signature item, and uses another DereferenceEx to locate that item. Next, it uses VerifySignature to determine whether the signature is valid. If so, it returns the string "Valid". If not, it uses DeleteSignature to delete the signature and returns the string "Invalid".
   Function CheckSignature(Form)
      Dim TempNode, SigNode  ' objects
      Dim SigStatus  ' Integer
      Dim SigItemRef  ' Strings
      Set TempNode = Form
      ' Get the SignatureButton node
      Set TempNode = TempNode.DereferenceEx(vbNullString, _
         "PAGE1.SignatureButton", 0, UFL_ITEM_REFERENCE, Nothing)
      ' Get a reference to the signature item from the signature option
      SigItemRef = TempNode.GetLiteralByRefEx(vbNullString, "signature", _
         0, vbNullString, Nothing)
      ' Get the signature item node
      Set SigNode = TempNode.DereferenceEx(vbNullString, SigItemRef, 0, _
         UFL_ITEM_REFERENCE, Nothing)
      ' Verify the signature
      SigStatus = Form.VerifySignature(SigNode, vbNullString, False)
      ' If the signature is not verified, then delete the signature and set
      ' the return code to "Invalid".  Otherwise, set the return code to
      ' "Valid".
      If (Not(SigStatus = UFL_DS_OK)) Then
         TempNode.DeleteSignature SigNode
         CheckSignature = "Invalid"
         CheckSignature = "Valid"
      End If
   End Function

Parent topic:
FormNodeP functions