Carnegie Mellon University Website Home Page
 

Step 6: Specify Required Fields (Optional)

Using hidden fields, you can specify that a field must be completed before the form can be submitted. If the user submits the form without completing the required field an error message is displayed.

Follow these steps to designate a field as required:

  1. For each field that you want to require, add the hidden field "RequiredFields" with the value set to the exact name of the field you want to require. Make sure you add the line after the <form> tag but before the </form> tag. The hidden field should look like this:

    <input name="RequiredFields" type="hidden" value="fieldname" />

    Where fieldname is the exact name of the field in your form. Remember, field names are case sensitive.

    For example, to make the "Name" field on our example form a required field, enter a hidden field as follows:

    <input name="RequiredFields" type="hidden" value="Name" />

Examples