2

I'm facing a strange issue since morning.

I have a Model, Controller and corresponding strongly typed View for ASP.NET MVC 4
In the view I'm using jquery, juqery.validate and jquery.unobtrusive.validate as follows:-

<script src="../../Scripts/jquery-1.10.2.min.js" type="text/javascript"></script>
<script src="../../Scripts/jquery-ui.min.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.form.min.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.validate.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.validate.unobtrusive.js" type="text/javascript"></script>

Now, if Jquery Unobtrusive Validate script files are imported, the form submitEvent will not get caught but skips it & submits the form -- means, the below code is skipped if I use jquery.validate.min.js and jquery.validate.unobtrusive.min.js

      $(document).ready(function () {
          $('form').submit(function (e) {
              alert('Submitting');
              e.preventDefault();
          });
      });

And, If I remove jquery.validate.min.js and jquery.validate.unobtrusive.min.js script files the above form submit event gets caught.

Ultimatey I want to use Unobtrusive Jquery Validation for my MVC Model/View as well as ajax Post method preventing normal submit, say by doing event.PreventDefault(); on submission

Kindly help, and Thank you all :-)

Vitthal
  • 546
  • 3
  • 18
  • I think this will answer your question: http://stackoverflow.com/questions/4747017/how-to-add-a-handlesubmit-function-when-using-jquery-unobtrusive-validation – ataravati Jul 05 '13 at 19:44

0 Answers0