On this page:

Require a Field

  1. Add this line of code to your Telegraph configuration file:
    <directive action="require" field="required-field-name" />

    • Example:
      <directive action="require" field="email" />

This will require that a field contain a value/input, either by typing into a field, selecting a checkbox or toggling a radio button.

Require that Two Fields Match

  1. Add this line of code to your Telegraph configuration file:
    <directive action="match" field1="first-field-to-match" field2="second-field-to-match/>>
  2. Replace first-field-to-match and second-field-to-match with the two fields which need to be matched (e.g., an email address).
    • Example:
      <directive action="match" field1="email1" field2="email2" />

Require that a Field Match a Given Format

  1. Add the format parameter to your <directive action=”require” /> tag. You can use any of the following “canned” formats:
    email A properly-formatted email address.
    ssn A Social Security Number. Note: Social Security Numbers should only be collected when using PGP Encryption.
    phone A 7-digit or 10-digit Phone Number.
    zip A 5-digit ZIP or 9-digit ZIP+4.
    url Any correctly-formatted website address.
    bu-url A valid and working URL for a page on the BU Web.
    bu-login A valid and current BU Kerberos login name.
    number Any number, including one with decimal values.
    positive Any positive numbers, including one with decimal values.
    negative Any negative numbers, including one with decimal values; this must be represented using a hyphen for the minus sign.
    integer Any integer.
    positive-integer Any positive integer.
    • Example #1 – Email:
      • <directive action="require" field="email" format="email" />
    • Example #2 – Phone Number:
      • <directive action="require" field="phone" format="phone" />

Display Error Messages on Your Form

  1. To show error messages on the form web page, add the imperius directive to your Telegraph configuration file:
    <directive action="imperius" filename="my-form-filename" />

    • Example:
      <directive action="imperius" filename="index.shtml" />

Error messages will display immediately underneath the opening <form> tag.
If you are creating a form for a WordPress site, replace the filename parameter with url and provide the path to your WordPress page.

    • Example:
      <directive action=”imperius” url=”/cragglerock/form/” />

Display Custom Error Messages

  1. To show custom error message when a required field isn’t filled out or doesn’t match a required format, add an error parameter to the action=”require” tag:
    <directive action="require" field="required-field" format="required-field" error="error-message" />

    • Example:
      <directive action="require" field="email" format="email" error="Please enter a valid email address." />