Signing datablock from field not in datablock

B

Bill Brown

I have a form with a signed databalck. I'm trying to use a signature field
onAfterChange event to sign the data.

here's the code:

set sgndata = XDocument.SignedDataBlocks(0)
if XDocument.SignedDataBlocks(0).Signatures.Count = 0 then
XDocument.UI.Alert("Not Signed")
XDocument.SignedDataBlocks(0).sign
end if

I'm getting an error: Invalid Context for OM Call

on the "XDocument.SignedDataBlocks(0).sign" line
and I'm not sure what the error means.

I'll have to do this as a cascade:

Data is submitted by employee, signed by superviser then chief.

Financial data might have to be entered and signed.

several other data sections and signatures msy have to be added depending on
the work flow and finally it has to be entered into the mainframe system.

The document has to be electronically unalterable at this point.

Any help on this would be appreciated.
 
G

Greg Collins

What it is likely telling you is that you cannot call Sign() during an
OnAfterChange event. There are lots of restrictions like this throughout
InfoPath. I didn't see anything specifically identified in the help file,
but eperience tells me this is most likely the case. It will work just fine
in an OnClick event though.

So what does this mean? A little less automation for you. You'll have to
tell the user need to sign it and instruct them to click a button to try
signing it again.
 
B

Bill Brown

Thanks, Greg. I used Infopath to create the onsign event then tried to call
it from the onafterchange event.
Here's the code Infopath generated:

Sub XDocument_OnSign(eventObj)

' The OnSign handler can be customized only in fully trusted form templates.

Dim Signature
Set Signature = eventObj.SignedDataBlock.Signatures.Create()

' You can add other pieces of information to sign by modifying the signature
template in Signature.SignatureBlockXmlNode

Signature.Sign()
eventObj.ReturnStatus = True

End Sub

I'm getting an "Object doesn't support this" error on this line:
Set Signature = eventObj.SignedDataBlock.Signatures.Create()

The form is not fully trusted yet, but I thought I would get a different
error than the "object doesn't support this" message that I do get.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top