Form

The form component defines styles and structural conventions to be used by forms and their necessary child elements (such as labels, inputs, text areas, and help text).

Structure

A form must always be wrapped in an element with the .cwf-form class, usually a <form> HTML element. Each grouping of a label, help text, and input must be wrapped in a .cwf-form__field element; This ensures optimal spacing between each field exists. Labels use the .cwf-form__label class, help text uses the .cwf-form__help class, and inputs, regardless of element type, use the .cwf-form__input class.

Groups

Groups allow the prepending and appending of elements to a form input to provide more context. A group is wrapped by a .cwf-form__group element, and can contain an input flanked by .cwf-form__symbol elements, which can be given FontAwesome icon classes to display an icon instead of text.

Icons

To provide a contextual icon on a form input, wrap it in a .cwf-form__icon element with addition FontAwesome icon classes.

Select boxes

Select boxes can be wrapped in an icon wrapper with a special .cwf-form__icon--select class; This displays a downward chevron icon that rotates when the select box is opened/closed.

Options

Options, such as radio or select buttons, wrap a label/input pair in a .cwf-form__option element. Optionally, a .cwf-form__option--inline modifier may be added to it to ensure the option and label are next to each other horizontally.

Styles

Form styles try to make inputs stand out from the background by giving them a light-gray background instead of the standard white background.

Validation

Visual form validation feedback can be provided by adding a validation modifier to .cwf-form__field element. This will change the color of .cwf-form__validation text, as well as the border and icon color of inputs.

Functionality

There is no form-specific functionality provided via javascript.

T4 implementation

The form component is not tied to a specific content type. It is included in the Compass T4 page layout CSS on every page.

Example

This field will be printed on your diploma

.00

The MC will use this to help pronounce your name as you walk across the stage

This input does not accept special characters such as -@$%^*

Our office offers three appointment times to pick up your diploma

Share about a time at VCU you'll always remember

As a graduate, you'll get an awesome new VCU tee shirt

Programs will be mailed June 10th

Must be at least 8 characters long