【问题标题】:Html hidden fields not submitted with form in IEHtml 隐藏字段未与 IE 中的表单一起提交
【发布时间】:2015-08-12 20:09:38
【问题描述】:

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

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

HTML

 <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>");

所以我在提交按钮的焦点上设置 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"]);
    }

【问题讨论】:

标签: javascript html


【解决方案1】:

隐藏字段的位置对 IE 很重要。我将隐藏字段放在不在 tr 或 td 中的表中。只是将田地移到外面。有用。

【讨论】:

    【解决方案2】:

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-11-05
      • 2022-01-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多