Skip to content

Inclusion validator #1

Description

@asaf

Inclusion validator

Define a list of allowed values.

Validator options:

message: Override default validator message.
allowBlank: if true validation will be skipped for empty value.
range: An array of two elements where 1st element as the lower bound & 2nd element as the upper bound of the range.
in: An array of allowed values.

Note: range / in cannot be mixed together.

Examples:

inclusion: { 
  range: [18, 150], 
  allowBlank: true, 
  message: 'Age must be between 18-150 or empty' 
}
inclusion: { in: ['Private', 'Public'] }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions