0

I have a form, and I would like to know if it validates while not submitting it. I need the value.

 var validation = $(idFormulario).validate({
   errorClass: 'jqInvalid',
   errorPlacement: function (error, element) {
        return false;
   },
  success: function(e){
       return false; //not submit
  }
});

It doesn't work. How can I check if form is valid?

Sparky
  • 98,165
  • 25
  • 199
  • 285
cucuru
  • 3,456
  • 8
  • 40
  • 74
  • 4
    Use `valid()` method to check the validity of fields - https://jqueryvalidation.org/valid/ – Saumya Rastogi Nov 09 '16 at 15:19
  • Also, [read the documentation for `success`](https://jqueryvalidation.org/validate/#success), it has nothing to do with submission of the form. – Sparky Nov 09 '16 at 16:48

1 Answers1

0

As mentioned in the above comment you've to use valid().

Description: valid() Checks whether the selected form is valid or whether all selected elements are valid.

Example :

$(idFormulario).valid();

Hope this helps.

Zakaria Acharki
  • 66,747
  • 15
  • 75
  • 101
  • 1
    Why @SaumyaRastogi ?!! we make content here for the future readers and not just for the author of the OP.. Thanks for your intervention. – Zakaria Acharki Nov 09 '16 at 16:19
  • 1
    This content could be found in the link supplied in the first comment, we don't want to encourage the OP to ask low quality questions that simply could be answered by looking at the documentation. – Offir Nov 09 '16 at 16:32
  • That why `flag` is under every post, and you could use it anytime when you feel that it's necessary. (and downvoting the correct answer is not a good habit since it's not made for this purpose, agreed?) – Zakaria Acharki Nov 09 '16 at 16:35