Skip to main content

Validation System

Ziva provides a powerful and flexible validation system for checking user input in InputTask. The system includes built-in validators for common cases and the ability to create custom validators.

Core Concepts

Validator Interface

The validator receives an input string and returns an error if the input doesn’t meet requirements.

Applying Validation

Validation is performed when confirming input (pressing Enter). If validation fails, the user is shown an error and prompted to enter data again.

Built-in Validators

Ziva provides a validator factory through ziva.DefaultValidators:

Basic Validators

Format Validators

Network Validators

Password Validators

Usage Examples

Email Validation

Port Validation

Password Validation

Complex Validation

Best Practices

1. Use Appropriate Input Types

2. Provide Clear Error Messages

3. Validate by Context

See Also