DEMOS / Validation

Nitrogen allows you to declare validation roles on elements that are fired during a postback using the #validate{} action.

The form to the right requires a valid name and email address, matching passwords of at least 6 characters, and validating that an entered number is an integer, and is between a specified range.

It also demonstrates attaching a validation message to a different Nitrogen Element (in this case attaching the validator for the 'number' textbox to the continue button). Finally, it demonstrates using the invalid_event/1 functionality introduced in 2.2.0, for triggering events when validators fail.

View Module Source

Copyright © 2008-2024 Nitrogen Web Framework. Released under the MIT License.