dynamic form ajax beginform validation error - MVC

188 Views Asked by At

Implementation Detail:

  • Page has Add Button and Table view
  • On Add button click, partial view (form) is loaded on Modal PopUp. Dynamic form selected based on parameter.
  • On Add button click below code is used to bind the partial view form to div

    $.ajax({
                url: '/Controller/GetModal',
                data: { modalType: modalType },
                success: function (data) {
                    $('#modalWrapper').html(data);
                    $('.modal-wrapper').modal();
                     }
               });

  • Partial View Form implemented using

    Ajax.BeginForm("Save", "Controller",new AjaxOptions
                        {
                            HttpMethod = "POST",
                            UpdateTargetId = "divTableView",
                            LoadingElementId = "loading"
                        }))

Issue : - On Click of save validation is not getting triggered.

Other Information :

Script Files:

bootstrap.js
 jQuery-3.5.1.js
 jquery.unobtrusive-ajax.js
 jquery.validate.js
 jquery.validate.unobtrusive.js

I Have tried adding below code in ajax success method


    $.validator.unobtrusive.parse(form);

Got Below Error:


    $.validator is undefined

Thanks In Advance for help.

0

There are 0 best solutions below