Calyxo Forms Concepts

The central notion of the Calyxo Forms component is that of a validator, which is used for the validation of a single input field. Additionally it allows the definition of validation rules concerning two or more input fields of a form, the so called assertions. Below we'll have a glance at these ideas, which will be explained in more detail on the following pages.

Validators

Calyxo Forms comes with lots of so called validators, which handle the standard tasks evolving during input validation: for example, they match regular expressions, they convert input strings into standard data types like numbers or dates, and they allow you to check the resulting property values to fulfill your requirements.

All of the Calyxo Forms validators are ready to use, but if you feel the need for additional validators, Calyxo Forms offers an extension mechanism, which allows the definition of custom validators.

Assertions

Whereas the validators are aimed at single field validation, Calyxo Forms does offer you a powerful tool for the additional validation of dependencies between two or more input fields of the same input form: the so called assertions.

An assertion allows you to write your validation condition as a boolean expression, which may contain variables referring to input strings or already converted property values. The expressions may contain many standard functions, but again: if you are missing anything, Calyxo allows you to enhance the expression's features by adding your own set of functions.

Error messages

As usually all Calyxo Forms messages are kept in message bundles and referred by a message key. They can be associated with a validator or an assertion. In addition to returning an error message describing the invalid input, Calyxo Forms allows you easily to mark the corresponding input fields optically (typically by turning the background into red).

Internationalization

I18n issues turn out to be relevant for input validation at three different places:

  • The input data has to be parsed in a locale specific manner, since dates or numbers have different string representations in different countries.
  • The same reason causes the formatting of property values to be locale dependent.
  • The error messages, which are caused by invalid input data, have to be localized.

Not only does the Calyxo Forms component provide support to handle all these issues easily. It also offers the possibility of defining locale dependent form definitions, which allow localized assertions as well.