Digital Signatures: Layout Tricks
Folks frequently ask whether it is possible to customize the InfoPath user interface around digital signatures. Some want to show the signature at the very bottom of the form; others want to show signatures side-by-side; others want to disable form submissions when the document wasn't digitally signed. In this article, we'll look at different ways you can tweak the form design to make it happen.
Trick 1: Display signature at the bottom of the view
InfoPath lets you show digital signature UI ("click here to sign this form") under a signable section; however, this section doesn't have to include any controls! This means that you can have your signable section with controls at the top of the form, some extra content in the middle, and then another section bound to the same nodes in the data source without any controls in it.
Your design view would look like this:
Note how the signableGroup here is multiply bound; the first section has the "allow users to digitally sign this section" checkbox unchecked:
The second one has it checked, which makes the "click here to sign this form" show up; this is how the end result looks at edit-time:
Trick 2: Disallow Submit if form was not signed
InfoPath digital signatures are appended to form XML, just like form data. For example, in the form above, nodes under signature1 will store the digital signature when the user adds it:
Using this fact, we can enforce business rules in our form: for example, what if we don't want to allow form submissions for cases when form is not signed? Let's go to Tools | Submit Options and create two rules:
1) Show must-sign warning:
- condition: signatures2 node is blank (this will evaluate to true when no signature was added)
- action: show a dialog box message "you must sign the form before submitting it"
- check "stop processing rules when this rule finishes"
2) Submit to main data source:
- condition: always applies (unless the first rule fired - we wouldn't get to this execution point then)
- actions: submit to main data source + show dialog box message "submission was successful"
Trick 3: Show signatures side-by-side
Challenge: make a form that has signatures side-by-side at the bottom; additionally, person 3 should only be able to add their signature if previous signer (person 2) already signed the document.
We already know how to make the signatures appear at the bottom of view (trick 1); we also know how to determine if a signature was added to the document (trick 2). Let's put all of these tricks together into one powerful solution:
- Create 3 different signed data blocks, one for each person that will be signing the form. Second data block needs to signing a superset of data that the first one signed, etc. Your data source task pane will look like this:
- Place empty sections bound to the items that you want to sign in the columns of that table.
- Use containing conditionally-formatted sections to show the signing UI only when necessary.
The resulting layout will look like this:
I'm attaching a sample form template that has this trick implemented (works in InfoPath 2003 or 2007; save the XSN to your computer before opening it).