首頁 > web前端 > js教程 > 主體

jqGrid增加時--判斷開始日期與結束日期(實例解析)_jquery

WBOY
發布: 2016-05-16 17:16:58
原創
1160 人瀏覽過
複製程式碼 程式碼如下:

$("#btnAddSaveTestSubject").click(function () {
        //增加時的驗證,保存
  {
            return this.optional(element) || value != 0;
       (value, element ) {
            return this.optional(element) || value != 0;
       ", function (value, element ) {
            return this.optional(element) || value != 0;
       idate({
            event : "blur",
            debug: true,
                       wrapper: "div",
            errorPlacement: function (error, element ) {
                                  },
            rules: {
           required: true,
                    admissionBatch: true
            "etsadd_educationLevel": {
                   true
                },
              🎜>                    required: true,
                    professionalProperty: true
                }
            },
            messages: {
                "etsadd_admissionBatch": {
                    required: "請選擇招生批次",
                    admissionBatch: "請選擇招生批次"
                },
                "etsadd_educationLevel": {
                    required: "請選擇學歷類型",
                    educationLevel: "請選擇學歷類型"
                },
                "etsadd_professionalProperty": {
                        professionalProperty: "請選擇專業性質"
                    submitHandler: function (form) {
               if (idArray == null || idArray == "" ) {
                    jAlert("請選擇測驗科目!", "提示資訊");                for (var i = 0; i                        jAlert("測試科目" jQuery("#testSubjectGrid").jqGrid("getCell", idArray[ i], "display_content") "的開始時間不能為空!", "提示訊息");
                      }
                    if ($("#exam_endtime_" idArray[i]).val () == "") {
                        jAlert("測試科目" jQuery("#testSubGrid,tap").jq  jAlert("測試科目" jQuery("#testSubGrid,tap").jqin", 可能為空的結束時間》 "提示資訊");
                        return;
                   var reg_ymd = /^([/d]{4})-([/d]{1,2})-([/d] {1,2})$/; //校驗日期的正規
                    begindata = $("#exam_begintime_      enddata = $("#exam_endtime_" idArray[i]).val ();
                    var arr_dt1, arr_dt2;
    );
                    arr_dt2 = enddata.match(reg_ymd);
    1] "/" arr_dt1[2] "/" arr_dt1[3]);
                    enddata = new Date(arr_dt2[1] "/"arr_2[              if (begindata > enddata) {
                        jAlert("測試科目" jQuery("#testSubjectGrid").jqGrid("getCellCell", 7p[getCell"); 🎜>                        return;
                    }
                    if ($("#exam_turn_" idArray[i]).val() == "") {
                        jAlert("測試科目" jQuery("#testSubjectGrid") .jqGrid("getCell", idArray[i], "display_content") "的考試場次不能為空!", "提示訊息");
                       }
                   exam_turn_" idArray[i]).val() != "") {
                                      var nubmer = $( "#exam_turn_" idArray[i]).val();
                                    jAlert("測試科目" jQuery("#testSubjectGrid").jqGrid("getCell" , idArray[i], "display_content") "的考試場次必須為數字!", "提示訊息");
                                 }
                   ]).val().length > 8) {
                         "的考試場次不能大於8位元數!", "提示訊息");
                               }
                    }
               }
                           $("#AddEntranceTestSubjectFrom").ajaxSubmit({
          ",
                        數據類型: 'json',
                      clearForm: false,
                        數據: {
                            strJson: JSON.stringify({
                                test_course_id: idArray.join("&")
})
                        },
                                 var json = eval("(" data ")");                           if if (json.suc ==           $("#entranceTestSubjcetMask").hide();
              .hide();
                              entranceTestSubjectGrid ").trigger("reloadGrid");
                                      }
                     });
            }
        });
    });

相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板