# Requiring Users to Enter Values in Form Fields

One of the limitations of HTML forms is the inability to define input fields as required. Because this is a particularly important requirement for database applications, ColdFusion provides a server-side mechanism for requiring users to enter data in fields.

To define an input field as required, use a hidden field that has a NAME attribute composed of the field name and the suffix "_required." For example, to require that the user enter a value in the FirstName field, use the syntax:

    <INPUT TYPE="hidden" NAME="FirstName_required">

If the user leaves the FirstName field empty, ColdFusion rejects the form submittal and returns a message informing the user that the field is required. You can customize the contents of this error message using the VALUE attribute of the hidden field. For example, if you want the error message to read "You must enter your first name," use the syntax:

    <INPUT TYPE="hidden"
        NAME="FirstName_required"
        VALUE="You must enter your first name.">