Installation

Get CBValidation installed in your ColdBox application and configure it for validation workflows.

Instructions

Leverage CommandBox to install via your CLI

box install cbvalidation

The module will register several objects into WireBox using the @cbvalidation namespace. The validation manager is registered as ValidationManager@cbvalidation. It will also register several helper methods that can be used throughout the ColdBox application.

System Requirements

  • BoxLang 1+ (Preferred)

  • Lucee 5+

  • ColdFusion 2023+

Mixins - Helper Methods

The module will also register the following methods in your handlers/interceptors/layouts/views

  • validate()

  • validateOrFail()

  • getValidationManager()

  • validatehasValue()

  • validateIsNullOrEmpty()

  • assert()

Delegate Mode

If you are using ColdBox 7, then you can use the Validatable@cbValidation delegate. Which will allow you to add these validation traits to any object you desire.

The methods delegated by default are the following:

  • assert()

  • getValidationManager()

  • getValidationResults()

  • isValid()

  • validate()

  • validateHasValue()

  • validateIsNullOrEmpty()

  • validateOrFail()

You can also use the delegation for only certain methods if needed:

WireBox Integration

The module will register several objects into WireBox using the @cbvalidation namespace. The validation manager is registered as ValidationManager@cbvalidation, which is the one you can inject and use anywhere you like.

Last updated

Was this helpful?