Skip to content

Basic Usage

albertmoreno edited this page Apr 13, 2015 · 47 revisions

Laravel Javascript Validation ships with a simple, convenient facility for configuring rules error messages via the JsValidator facade.

The JsValidator created by the Facade inherits from Laravel Validation, so you can use all methods and procedures that Laravel provides to setup your validations.

When the instance is printed in a view the Javascript code needed to validate your form is rendered to the page.

To create validator you can use Laravel validation rules or defined Form Request

  • Rulesets
  • [Form Request] (Form-Request)
Implemented rules
Disable Javascript validation for certain fields

Is possible disabe javascript validation for certain fields. To do that you have to add no_js_validation to fields rules.

$rules=array(
     'name'  =>'required',
     'phone' => 'numeric|no_js_validation'
);

In this example the field phone wont be validated with Javascript

Clone this wiki locally