1

I am using laravel-jsvalidation to validate forms on client side but the plugin validate the form after submit.

How can I change it to a real-time validation while user is inputting data?

Calling plugin:

<script type="text/javascript" src="{{ asset('vendor/jsvalidation/js/jsvalidation.js')}}"></script>
{!! $validator->selector('#review-form')  !!}

Form:

    <form action="{{action('GoToTheController')}}" method="POST" id="review-form">
        <div class="form-group"><input type="text" class="fullName" name="fullName">
        </div>
    </form>

Controller:

    $validator = JsValidator::make( ['fullName'=> 'required']);

    return view('create')->with('validator', $validator);
Mossen
  • 574
  • 5
  • 17
  • 1
    read your question and try to imagine that someone else asked it, can you give him a answer without knowing any details at all? without seeing any code? – Amir Bar Jun 30 '16 at 10:58
  • @AmirBar, I've added the code but if you used the plugin before you may be able to answer my question, nothing is especial with the usage of it. – Mossen Jun 30 '16 at 11:33

1 Answers1

0

In bootstrap.php under the plugin(laravel-jsvalidation) folder I added these lines so it works fine by clicking on input elements.

    onfocusout: function (element) {
            if (!this.checkable(element)) {
                this.element(element);
            }
        }

or you can make a copy of the file, add the above lines into it and use it.

Mossen
  • 574
  • 5
  • 17