There are several ways to validate the content of a component. In general input components have the option for validation. In the following sections, the different kinds von validation are explained.

Tag Library Documentation: |

A simple way of validation is the `required` attribute in some input components. The text area must not empty if the submit button is pressed. Otherwise a error message is displayed.

<tc:textarea label="Text Area" required="true"/>

The length of a value can be validated by the `<f:validateLength/>` tag. Length means the number of characters. In this example, the given string must have at least two characters and maximal four characters.

Please note, an empty string will not be validated.

<tc:in label="Input"> <f:validateLength minimum="2" maximum="4"/> </tc:in>

The range of a number can be validated via `<f:validateLongRange/>` or - for floating point numbers - `<f:validateDoubleRange/>`. In the following input field numbers from 3 to 77 can be added.

<tc:in label="Number" markup="number"> <f:validateLongRange minimum="3" maximum="77"/> </tc:in>

A value can be validated against a regex patter via the `<f:validateRegex/>` tag.

<tc:in label="Letter & Number" > <f:validateRegex pattern="[A-Za-z][0-9]"/> </tc:in>

The value in the field must be a word character combined with a number. For example 'T3'.

It's also possible to add custom validators using the `validator` attribute of an input component. In this case, only the string 'Tobago' (uppercase/lowercase ignored) is accepted.

A validator check the password against the confirmation field. To get access to the confirmation field from the validator a binding with the `binding` attribute and the `<f:attribute/>` tag is created.

<tc:in label="Password" validator="\#{validationController.passwordValidator}"> <f:attribute name="confirmationField" value="\#{confirmBinding}"/> </tc:in> <tc:in label="Confirmation" binding="\#{confirmBinding}"/>