The Validation Module

The Validation Module delivers robust and secure form validation with support for standard field types, file uploads, and custom validation rules. Features include CSRF protection, multiple date/time format validators, file type and size validation, image dimension checking, and comprehensive error handling. The module makes it easy to validate user input with intuitive rule definitions and automatic error message generation.

Comprehensive guidance for this module can be found in the Form Handling chapter of the Trongate PHP framework documentation.

run()

Executes form validation and returns the result. This method performs automatic CSRF protection, runs validation tests, and stores errors in session for display.

set_rules()

Defines validation rules for a specific form field or file upload. This method is the foundation of Trongate's validation system, allowing you to specify which fields are required, what format they should have, and what constraints they must meet. Each call to set_rules() validates one field according to the specified rules.