Skip to content

Troubleshooting

albertmoreno edited this page Jan 13, 2016 · 6 revisions

Re-validation take place after every keystroke

After an initial validation, if a field has an error, any further editing of the field will fire a re-validation after every keypress.

This is the default behaviour of jQuery Validation Plugin. You can disable onkeyup event in jsvalidation view

resources/views/vendor/jsvalidation/bootstrap.php

<script>
    jQuery(document).ready(function(){
        $("<?php echo $validator['selector']; ?>").validate({
            errorElement: 'span',
            errorClass: 'help-block error-help-block',
            onkeyup: false,

Fatal Error __toString() must not throw an exception in view rendering

Some times Fatal Error Method \Proengsoft\JsValidation\Javascript\JavascriptValidator::__toString() can occur when view is rendered using __toString() magic method.

<script type="text/javascript" src="{{ asset('vendor/jsvalidation/js/jsvalidation.js')}}"></script>
{!! JsValidator::formRequest('App\Http\Requests\FontUploadRequest') !!}

This happen when occurs any Exception, because [You cannot throw an exception from within a __toString() method. Doing so will result in a fatal error.] (http://php.net/manual/en/language.oop5.magic.php#object.tostring).

To debug your code you can use render() method tho generate Javascript Validations. In this case the exceptions are thrown as usual.

JsValidator::formRequest('App\Http\Requests\FontUploadRequest')->render()

Some Javascript Validations doesn't work as expected after update

Configure your composer.jsonfile according Insallation guide.

Publish the javascript assets provided with the package.

php artisan vendor:publish --provider="Proengsoft\JsValidation\JsValidationServiceProvider" --force
Clone this wiki locally