Community articleSignForm function
Added by IBM contributorIBM on July 26, 2013
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars


This function takes a button node and creates a digital signature for that button. The signature is created using the signature filter in the button and the private key of the signer.


   Function SignForm(
      signer As ICertificate, 
      theInfo As IStringDictionary, 
      theStatus As Long
      ) As ISignature


Table 1. Function parameters
theSignerICertificateThe certificate to use to create the signature.
theInfoIStringDictionaryAlways use a null value.
theStatusLongThis is a status flag that reports whether the operation was successful. Possible values are:
SUSTATUS_OK — the operation was successful.
SUSTATUS_CANCELLED — the operation was cancelled by the user.
SUSTATUS_INPUT_REQUIRED — the operation required user input, but could not receive it (for example, it was run on a server with no user).


A signature object if the call is successful, or throws an exception if an error occurs.


The following function uses DereferenceEx to locate a signature button in the form. It then calls GetCertificateList to get a list of valid certificates for that button. The function then loops through the available certificates, using GetDataByPath to check the common name of each certificate. When it finds the certificate with the common name of "TJones", it calls SignForm and uses that certificate to sign the form.
   Sub ApplySignature(Form)
      Dim SigNode, SigObject  ' objects
      Dim TheCerts  ' CertificateList
      Dim CommonName  ' String
      Dim Cert  ' ICertificate
      ' Get the SignatureButton node
      Set SigNode = Form.DereferenceEx(vbNullString, _
         "PAGE1.SignatureButton", 0, UFL_ITEM_REFERENCE, Nothing)
      ' Get available certificates for that button
      Set TheCerts = SigNode.GetCertificateList(vbNullString, 1) 'vbNull
      ' Test each of the available certificates to see if it has a common
      ' name of "TJones".  If it does, use that certificate to sign
      ' the form.
      For Each Cert in TheCerts
         CommonName = Cert.GetDataByPath("SigningCert: Subject: CN", _
            False, 1) ' vbNull
         Response.Write CommonName & vbCrLf
         If CommonName = "TJones" Then
            Set SigObject = SigNode.SignForm(TheCerts(1), Nothing, 1) 
               ' vbNull
         End If
   End Sub

Parent topic:
FormNodeP functions