Menu

Client-Side Javascript Validation

Aire has built-in client-side validation that uses Laravel's rule syntax. Just pass an array of Laravel rules to Aire, and any rule that can be validated by the client will be.

See the validation rules for this form

Source Rules

The validation in this form was generated from the following code.

(Please note that most form fields are named the same as the validation rule. This is simply because this demo was built to show all the rules that Aire supports. You can name your fields anything you like.)

Aire::open()
  ->rules([
    'accepted' => 'accepted',
    'after_reference' => 'after:reference_date',
    'after_or_equal_reference' => 'after_or_equal:reference_date',
    'before_reference' => 'before:reference_date',
    'before_or_equal_reference' => 'before_or_equal:reference_date',
    'date' => 'date',
    'alpha' => 'alpha',
    'alpha_dash' => 'alpha_dash',
    'alpha_num' => 'alpha_num',
    'array' => 'array',
    'between' => 'numeric|between:2,4',
    'confirmed' => 'confirmed',
    'different' => 'different:different_from',
    'digits' => 'digits:5',
    'email' => 'email',
    'in' => 'in:foo,bar,baz',
    'not_in' => 'not_in:foo,bar,baz',
    'integer' => 'integer',
    'min_string' => 'min:5',
    'min_number' => 'numeric|min:5',
    'max_string' => 'max:5',
    'max_number' => 'numeric|max:5',
    'regex' => 'regex:/^[a-z]\d{4}$/i',
    'numeric' => 'numeric',
    'required' => 'required',
    'required_if' => 'required_if:required,yes',
    'required_unless' => 'required_unless:required_if,no',
    'required_with' => 'required_with:required_unless',
    'required_with_all' => 'required_with_all:required,required_if,required_unless,required_with',
    'required_without' => 'required_without:required_with_all',
    'required_without_all' => 'required_without_all:required,required_if,required_unless,required_with,required_with_all,required_without',
    'same' => 'same:same_target',
    'size_string' => 'size:5',
    'size_number' => 'numeric|size:5',
    'url' => 'url',
  ])
  ->messages([
    'accepted' => 'You must accept the terms',
  ]);