如何使用验证插件jQuery来验证复杂的对象

时间:2020-04-30 12:02:52

标签: jquery asp.net asp.net-mvc

jquery验证插件的新手,但我想知道我们如何使用验证插件来验证输入框数组。

var index = $("#tbQual").children("tr").length;
var indexCell = "<td style='display:none'><input name='JobApplicantQualification.Index' type='hidden' value='" + index + "' /></td>";
var titleCell = "<td><input id='JobApplicantQualification_" + index + "__NmaeofQualification' name='JobApplicantQualification[" + index + "].NmaeofQualification' type='text' value='' /></td>";
var publishedCell = "<td><input id='JobApplicantQualification_" + index + "__University' name='JobApplicantQualification[" + index + "].University' type='text' value='' /></td>";
var FromDate = "<td><input class='sysdate' id='JobApplicantQualification_" + index + "__FromQDate' name='JobApplicantQualification[" + index + "].FromQDate' type='text' value='' /></td>";
var To = "<td><input class='sysdate' id='JobApplicantQualification_" + index + "__ToQDate' name='JobApplicantQualification[" + index + "].ToQDate' type='text' value='' /></td>";
var removeCell = "<td><input id='btnremBook' class='remqual' type='button' value='Remove'  /></td>";

var newRow = "<tr  id='trBook" + index + "'>" + indexCell + titleCell + publishedCell + FromDate + To + removeCell + "</tr>";
$("#tbQual").append(newRow);

如何验证JobApplicantQualification。像这样的东西

$('#btnsubmit').on('click', function() {
  $('form').validate({
    submitHandler: function(form) {
      form.submit();
    },
    rules: {
      'JobApplicantQualification[]': {
        required: true
      }
    },
  });
});

我要验证才能打印一份证书

0 个答案:

没有答案
相关问题