How to validate form in jQuery using jQuery Form Validator

How to validate form in jQuery using jQuery Form Validator

How to validate form in jQuery using jQuery Form Validator

There are multiple jquery plugins to validate forms but i am going to tell you how to validate a simple form in jquery, even though this plugins have so many attribute option rules to validate form such as :

  1. maxWords
  2. minWords
  3. rangeWords
  4. letterswithbasicpunc
  5. alphanumeric
  6. lettersonly
  7. nowhitespace
  8. ziprange
  9. zipcodeUS
  10. integer
  11. vinUS
  12. dateITA
  13. dateNL
  14. time
  15. time12h
  16. phoneUS
  17. phoneUK
  18. mobileUK
  19. phonesUK
  20. postcodeUK
  21. strippedminlength
  22. email2 (optional TLD)
  23. url2 (optional TLD)
  24. creditcardtypes
  25. ipv4
  26. ipv6
  27. pattern
  28. require_from_group
  29. skip_or_fill_minimum
  30. accept
  31. extension

Here is a simple form which i will validate using jQuery.


  1. {!! Form::open(array('route' => 'your_route','method'=>'POST','files'=>true,'id'=>'myform')) !!}
  2. <div class="col-xs-12 col-sm-12 col-md-12">
  3. <div class="form-group">
  4. <strong>Name:</strong>
  5. {!! Form::text('name', null, array('placeholder' => 'Name','class' => 'form-control')) !!}
  6. </div>
  7. </div>
  8. <div class="col-xs-12 col-sm-12 col-md-12">
  9. <div class="form-group">
  10. <strong>Email:</strong>
  11. {!! Form::text('email', null, array('placeholder' => 'Email','class' => 'form-control')) !!}
  12. </div>
  13. </div>
  14. <div class="col-xs-12 col-sm-12 col-md-12">
  15. <div class="form-group">
  16. <strong>Phone:</strong>
  17. {!! Form::text('phone', null, array('placeholder' => 'Mobile No','class' => 'form-control')) !!}
  18. </div>
  19. </div>
  20. <div class="col-xs-12 col-sm-12 col-md-12">
  21. <div class="form-group">
  22. <strong>Details:</strong>
  23. {!! Form::textarea('details', null, array('placeholder' => 'Details','class' => 'form-control','style'=>'height:100px')) !!}
  24. </div>
  25. </div>
  26. <div class="col-xs-12 col-sm-12 col-md-12 text-center">
  27. <button type="submit" class="btn btn-primary">Submit</button>
  28. </div>
  29. {!! Form::close() !!}

Now include this script before closing body tag.


  1. <script src="http://demo.expertphp.in/js/jquery.validate.min.js"></script>
  2. <script>
  3. $(document).ready(function () {
  4. $('#myform').validate({ // initialize the plugin
  5. rules: {
  6. name: {
  7. required: true
  8. },
  9. email: {
  10. required: true,
  11. email: true
  12. },
  13. phone: {
  14. required: true
  15. },
  16. details: {
  17. required: true
  18. }
  19. }
  20. });
  21. });
  22. </script>

Now you can validate your form using jQuery. Click here to see the example to validate form using jQuery.

Phone: (+91) 8800417876
Noida, 201301
sakarya escort akyazı escort arifiye escort erenler escort eve gelen escort ferizli escort geyve escort hendek escort otele gelen escort sapanca escort söğütlü escort taraklı escort
sakarya escort - akyazı escort - arifiye escort - erenler escort - eve gelen escort - ferizli escort - geyve escort - hendek escort - karapürçek escort - karasu escort - kaynarca escort - kocaali escort - otele gelen escort - pamukova escort - sapanca escort - söğütlü escort - taraklı escort
sapanca escort hendek escort karasu escort escort sakarya sakarya escort bayan adapazarı escort sakarya escort sakarya escort sakarya escort sakarya escort sakarya escort sakarya escort