pseudoagentur / soa-jsvalidation
Validate forms transparently with Javascript reusing your Laravel Validation Rules, Messages, and FormRequest
Requires
- php: >=5.4.0
- illuminate/config: ~5.0
- illuminate/contracts: ~5.0
- illuminate/http: ~5.0
- illuminate/support: ~5.0
- illuminate/validation: ~5.0
- illuminate/view: ~5.0
Requires (Dev)
- mockery/mockery: 0.9.*
- phpunit/phpunit: ~4.0
This package is not auto-updated.
Last update: 2017-10-12 09:14:58 UTC
README
Laravel Javascript Validation package allows to reuse your Laravel Validation Rules, Messages, FormRequest and Validators to validate forms automatically in client side without need to write any Javascript code or use HTML Builder Class.
You can validate forms automatically referencing it to your defined validations. The messages are loaded from your validations and translated according your Localization preferences.
Feature overview- Automatic creation of Javascript validation based on your Validation Rules or FormRequest, no Javascript coding required.
- Supports other validation packages.
- AJAX validation for ActiveURL, Unique and Exists Rules, Custom Validation Rules and other validation packages
- Unobtrusive integration, you can use without Laravel Form Builder
- The package uses Jquery Validation Plugin bundled in provided script.
- Uses Laravel Localization to translate messages.
All Validation Rules provided by Laravel and other packages are supported.
Almost are validated in client-side using Javascript, but in some cases, the validation should to be done in server-side via AJAX:
- ActiveURL
- Unique
- Exists
- Custom Validation Rules
- Validations provided by other packages
The easiest way to create Javascript validations is using Laravel Form Request Validation.
InstallationFollow the Installation Guide to install the package. The default config shlould work out-of-box
Validating Form RequestCall JsValidator Facade in your view to validate any FormRequest
<form> <!-- ... My form stuff ... --> <form> <!-- Javascript Requirements --> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.1/js/bootstrap.min.js"></script> <!-- Laravel Javascript Validation --> <script type="text/javascript" src="{{ asset('vendor/jsvalidation/js/jsvalidation.js')}}"></script> {!! JsValidator::formRequest('App\Http\Requests\MyFormRequest') !!}
Take a look to Basic Usage or Examples to get more information.
DocumentationTo get more info refer to Project Wiki
Known issues- DateFormat rule don't support timezone format
The MIT License (MIT). Please see License File for more information.