Javascript 当jqgrid最后一行字段为空时,无法提交表单

Javascript 当jqgrid最后一行字段为空时,无法提交表单,javascript,jquery,forms,jqgrid,Javascript,Jquery,Forms,Jqgrid,在我的应用程序中,有一个表单由一些文本框和jqgrid组成。假设我想提交整个表单的数据,那么数据已经提交,但我想验证jqgrid,一些列不应该为空。 以下是我正在尝试的:我正在尝试做的事情是,当jqgrid的最后一行为空时,显示警报消息。这是工作,但警报后,单击警报弹出窗口上的“确定”,然后如果最后一行列为空,则该表单也将提交 我正在尝试这段代码,因为jqgrid中的最后一列是空的。但我想要的代码不是jqgrid前几行的空字段 这是我的密码 `$("button.hook-submit--act

在我的应用程序中,有一个表单由一些文本框和jqgrid组成。假设我想提交整个表单的数据,那么数据已经提交,但我想验证jqgrid,一些列不应该为空。 以下是我正在尝试的:我正在尝试做的事情是,当jqgrid的最后一行为空时,显示警报消息。这是工作,但警报后,单击警报弹出窗口上的“确定”,然后如果最后一行列为空,则该表单也将提交

我正在尝试这段代码,因为jqgrid中的最后一列是空的。但我想要的代码不是jqgrid前几行的空字段

这是我的密码

`$("button.hook-submit--action").click(function (evt) {
        if ($("#Opportunity-form").valid()) {
            if (evt) {
                evt.stopPropagation();
            }
            var lastrowid = $("#Stages").find(">tbody>tr.jqgrow:last").attr('id');
            if ($('#' + lastrowid + '_CloseDate').val() == "") {
                evt.preventDefault();
                evt.stopPropagation();
                alert("close date not null");
            }
            var postData = getFormDataJson(), meassage,postAction;
            if (evt.target.name === 'create-Opportunity') {
                postAction = '@Url.Action("OpportunityAddNew", "Opportunity")';
                meassage = "Opportunity created successfully";
            }
            else {
                postAction = '@Url.Action("OpportunityEdit", "Opportunity")';

                meassage = "Opportunity updated successfully";
            }
            $('.validation-summary-errors').hide();
            $.ajax({
                type: "POST",
                url: postAction,
                data: JSON.stringify(postData),
                contentType: "application/json; charset=utf-8",
                beforeSend: function () {
                    $(".maindiv").show();
                },
                success: function (data) {
                    $("#myModalLabel2").html("");
                    str = data;
                    if (data.indexOf("successfully") > -1) {
                        $("#myModalLabel2").html("Successfull Message");
                    }
                    else {
                        $("#myModalLabel2").html("Error Message");
                    }
                    $("#getCodeModal").modal("toggle");
                    $("#getCode").html(data);
                },
                error: function (xhr, ajaxOptions, thrownError) {
                    alert("error");
                    alert(xhr.status);
                    alert(xhr.responseText);
                    alert(thrownError);
                },
                complete: function () {
                    $(".maindiv").hide();
                }
            });
        }`