You are here: Getting Started > Tutorials > Tutorial 3: Building advanced forms and workflows > T3-14. Use custom controls in InfoPath (Advanced)

Tutorial 3—Step 14: Use custom controls in InfoPath (Advanced)

In this exercise you will continue working with the following custom controls (added in previous exercises) in InfoPath:

  • WS.CurrentUser
  • WS.ProcessControl
  • WS.FormValidation
  1. Launch Winshuttle Designer and open the file from the previous exercise.
  2. Click Launch InfoPath.
  3. Insert the following controls into your form (placement does not matter.)
    • WS.CurrentUser
    • WS.ProcessControl
    • WS.FormValidation

    Note: Previous versions of Winshuttle form controls were named Sharevis.Studio. (For example: ShareVis.CurrentUser.)

  4. Add the following text boxes to your form and rename them:

    Place these text boxes inside of a table (just like it is below) and put them towards the top of the form.

    Text Box Name

    Field Name

    Full Name

    FullName

    Email

    Email

    Telephone Number

    Telephone

    Username

    Username

  5. Right click the WS.CurrentUser control, and then select WS.CurrentUser Properties

    Select Current User Info to configure the control.

     

    • In the Full Name XPath: field, insert the Field Name for your Full Name text box on your form.
    • In the User Name XPath: field, insert the Field Name for your Username text box on your form.
    • In the Email XPath: field, insert the Field Name for your Email text box on your form.

  6. Click OK.
  7. Right-click the WS.FormValidation control, and then select WS.FormValidation Properties.
  1. Click the Form Validation tab.
  2. In the Regular Expressions section, enter the following regular expression into the first RegExp field:

    \(?(\d{3})\)?-?(\d{3})-(\d{4})

  3. In the next text box under Field, enter the Field Name (Telephone) of your Telephone Number text box on your form.
  4. In the next text box under Message, enter a message that will be displayed if the user enters an invalid phone number.
  5. Click OK
  6. Save your form and then close it.
  7. Navigate to Winshuttle Designer and publish your form.
  8. Test your form--test your validation on the Telephone Number field by typing an invalid phone number.

    NOTE: Form Validation is not in real time! The form must be submitted (Save and Route) before the validation runs.

  9. You should see your error message displayed as in the following example.

This completes Tutorial 3.