函数函数函数调用未捕获错误:最大调用堆栈超出

时间:2013-09-19 06:49:31

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

即时通讯在jquery中我的代码有问题,当我从函数函数调用我的函数时,它会显示一条循环警告消息,并显示错误消息“未捕获错误:最大堆栈调用超出。”

这是我的代码:

@html:

<div class="main">
        @using (Html.BeginForm("AvailabilitySave", "Worker", FormMethod.Post, new { id = "AvailabilityForm" }))

        {

            <input type="hidden" id="availabilityId" name="workerId" value="@workerId" />

          <p>
                    <label for="dllAvailableDay">
                        <abbr title="This is a required field.">
                            <em><font color="red">*</font></em></abbr>
                        Available Day</label>
                    <span>
                        @Html.DropDownList("dllAvailableDay", new SelectList(ViewBag.availableDayList, "ID", "Display_Value", workerAvailableDay), "[Please Select]",
              new Dictionary<string, object>
                    {
                        {"class","validate[required] inputLong"}
                    })
                    </span>
                </p>
                <p>
                    <label for="TpStartTime">
                        <abbr title="This is a required field.">
                            <em><font color="red">*</font></em></abbr>
                        Start Time</label>
                    <span>
                        <input id="tpStartTime" name ="tpStartTime" value="@workerStartTime" 
                               style="padding:0 0 0 0 !important" />
                    </span>
                </p>

                <p>
                    <label for="TpEndTime">
                        <abbr title="This is a required field.">
                            <em><font color="red">*</font></em></abbr>
                        End Time</label>
                    <span>
                        <input id="tpEndTime" name ="tpEndTime" value="@workerEndTime" 
                                style="padding:0 0 0 0 !important"/>
                    </span>
                  </p>
    <p>
                    <label>
                        Anytime</label>
                    <span>
                        <input type="checkbox" name="chAnytime" id="chAnytime" value="true" checked="checked" />
                    </span>
                </p>
                <p>
                    <span>
                        <input type="submit" id="addAvailBtn" class="styledButton" value="Add" />
                    </span>
                </p>
}
</div>

我的js:

$("#AvailabilityForm").on('submit', function (e) 
    {
        var gvDetDDLs = $('#availabilityGrid').find("input[name=dllEditAvailableDay]");
        $.each(gvDetDDLs, function () {
            var duplicateExists = false;
            var ddlDay = $("#dllAvailableDay option:selected").text();

            var currVal = $(this).val();
            gvDetDDLs.not(this).each(function () {
                e.stopPropagation();
                if (ddlDay == currVal) {
                    duplicateExists = true;
                    alert("Duplicate entry is not allowed");
                    $(this).focus();
                    return false;
                }
            }
                );
        }
        );
        return true;

    }
);

我的方案是我想在你点击提交按钮时发出一条消息,它不会保存以防止重复输入。

请帮我解决这个问题???

谢谢

0 个答案:

没有答案