Html隐藏字段没有提交的形式在IE中

Html hidden fields not submitted with form in IE

本文关键字:IE 提交 隐藏 字段 Html      更新时间:2023-09-26

我在form中有一些hidden fields没有在IE中提交。但在chrome和firefox中运行良好。

Hidden field values在提交时没有出现在Request对象中。

 <input type="hidden" name="IsRepeatCustomer" value="" />
 <input type="hidden" name="LeadID" value=""/>

我将这些隐藏代码设置在

后面

代码块1

var bgColor = Convert.ToInt32(getLeads["NumSales"]) > 0 ? "#B3FFFF" : "#F5D0A9";
                            var isRepeatCustomer = Convert.ToInt32(getLeads["NumSales"]) > 0 ? "Y" : "N";
                            controlBuilder.Append("<tr bgcolor='" + bgColor + "'>");
                            controlBuilder.AppendFormat(@"<td><input type=submit name='submit' onFocus='LeadID.value ={0};IsRepeatCustomer.value=""{1}"";' value='Try This Duplicate' class='button-text' style='background-color: " + bgColor + "; width: 100%' /></td>", getLeads["LeadID"], isRepeatCustomer);
                            controlBuilder.AppendFormat("<td class='boldBodyText' nowrap='nowrap'>{0}&nbsp;</td>", getLeads["FirstName"]);
                            controlBuilder.AppendFormat("<td class='boldBodyText' nowrap='nowrap'>{0}&nbsp;</td>", getLeads["LastName"]);
                            controlBuilder.AppendFormat("<td class='boldBodyText' nowrap='nowrap'>{0}&nbsp;</td>", getLeads["Address"]);
                            controlBuilder.AppendFormat("<td class='boldBodyText' nowrap='nowrap'>{0}&nbsp;</td>", getLeads["Zip"]);
                            controlBuilder.AppendFormat("<td class='boldBodyText' nowrap='nowrap'>{0}&nbsp;</td>", getLeads["Phone"]);
                            controlBuilder.Append("</tr>");

所以我在提交按钮的Focus上设置LeadID和IsRepeatCustomer值。它在Chrome和FireFox中运行良好。

我不知道该怎么做才能使它在IE中工作。

代码块2

      private void TryThisDuplicate()
    {
        if (this.IsNewLead(Convert.ToInt32(Request["LeadID"]), Convert.ToInt32(SessionHelper.FirstUserSelectedStoreID)))
        {
            this.LoadQueueDataByDNIS();
            var sourceAndBreakDown = QueueHelper.GetDefaultSourceAndBreakdown(m_Queue);
            if (sourceAndBreakDown.Item1 != null && sourceAndBreakDown.Item2 != null)
            {
                this.UpdateLeadWithSourceAndSourceBreakDown(sourceAndBreakDown.Item1, sourceAndBreakDown.Item2, Convert.ToInt32(Request["LeadID"]), Convert.ToInt32(SessionHelper.FirstUserSelectedStoreID));
            }
        }
        Response.Redirect("/Lead?L=" + Request["LeadID"] + "&SS=Y&P=ADDNEWLEAD&RepeatCustomer=" + Request["IsRepeatCustomer"]);
    }

隐藏字段的位置对IE很重要。我将隐藏字段放置在表中,而不是在tr或td中。只是把田地移到了外面。它的工作原理。

我也遇到过这样的问题,我注意到这是与缓存有关的事情,你可以尝试通过在元数据中添加以下内容来禁用它。

<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">