Site icon @WonderLaura

InfoPath– Getting the “Signature”


You can add real digital certificates to your InfoPath forms, but there are a few problems with them:

  • They are not compatible with browser-based forms
  • They don’t collect any real data that you can do anything with.

So, for most clients I work with, they don’t need to have “real” certificates involved, and simply need to capture a person’s name and the date that they are signing a form.

Here’s my solution, which I use some variation of in every single form I create:

  1. In your InfoPath form, in the Fields on the right, right click on myFields and choose Add
  2. For the Name, type SignatureGroup.  For Type, select Group.  Click OK.
  3. Right-click on SignatureGroup, and click Add…
  4. For the Name, type SignatureCheck.  Click OK.
  5. Just like in steps 3/4, create another field called SignatureName
  6. Right-click on SignatureGroup one more time, and click Add…
  7. Name this one SignatureDate, and for data type, select Date.  If you need date and time, you can choose DateTime.  Click OK.
  8. You can right click on any field on the right, and pick what type of control it needs to be.  Insert SignatureCheck as a check box, and insert SignatureName and SignatureDate as calculated values.  Type “I agree” next to the check box.  You can add any kind of extra verbiage that you need, such as “by signing this form, I agree to this… blah blah”  Your company’s lawyers can probably provide you with that part. 

    (Note: inserting those fields as calculated values is pretty much the same as inserting them as text boxes and then setting them to read only.  The point is that we don’t want people to be able to edit it.)
  9. Click to select the check box.  Open the check box properties.  Notice that by default, the value when cleared is no, and value when checked is yes.  These are important to remember, even the proper capitalization (all lowercase).  Close the properties, and open the rules pane on the right.
  10. With the check box still selected, Click the New button in the rules pane.  Choose Action.
  11. In the Details for box, type checked.  The condition needs to be that SignatureCheck is equal to yes.  Click OK.
  12. Next to Run these actions, click the Add button.  Choose Set a field’s value.
  13. For the Field, choose SignatureName, and for the value, click the Function button and use the expression userName()   Click OK.
  14. Click the Add button again, and this time the field is SignatureDate, and the function is today()
    (If you used DateTime at step 7, you need to use the now() function instead)
  15. Next, we can add another rule, so that if the box is UNchecked, it clears the values out.  Select the “checked” rule, and click the little Copy icon at the top of the rule pane.  Click the Paste icon.
  16. Call this next rule “Uncheck”, and change the condition so that SignatureCheck is not equal to yes.
  17. Click the first action, and just delete the function out of the Value box so it’s blank.  Do the same for the other action, so that we’re basically clearing out both SignatureName and SignatureDate so they’re blank.
  18. Now test this out by clicking the Preview icon at the top.  Obviously you can make this prettier, but that part is up to you and your creativity.
    One more thing, is that you can disable the submit button if they do not check the box.  Click to select your Submit button.  Click the New button in the rules pane, and choose Formatting.
  19. Call this rule “disabled”.  The condition is if SignatureCheck is not equal to yes.  Click OK.
  20. Still in the rule pane, check the Disable this control box at the bottom of your new rule.

All done.  Now, if you don’t “sign” the document, you can’t submit it.  One thing to watch out for is the default submit button in the toolbar in InfoPath.  If you have this enabled, then people will be able to submit your form whether they signed it or not.  You can click the Data tab at the top, click Submit Options, and UNcheck the box for allow users to submit this form.  Now there will be no submit button in the toolbar.  You can also go to form options and remove the toolbar altogether if you want.

You’ll notice that when it captures your signature, it only gets your NT login name.  If you want to get all fancy and show a First Name, Last Name (which isn’t unique like the username), you could use the user profile service for that.  You can take a look at a recent post of mine to see how to obtain that information.

Exit mobile version