2015-09-04 78 views
-3

我有名稱文本框和地址文本框。當頁面加載時,我使用jQuery功能去設置禁用一些複選框和其他文本框。asp:textbox issue

他們的工作完美的,當我在本地調試,但發佈到生產的時候,用戶誰擁有隻讀權限不能選擇和複製名稱的文本框和地址文本框(這些jQuery函數不觸及這兩個文本框),這些文本框剛剛被凍結(名稱文本框和地址文本框爲只讀用戶禁用 - 從安全頁面設置)。

擁有完整權限的開發人員不存在此問題。

我試圖從代碼背後爲那些文本框設置焦點,似乎沒有工作。

在我的頁面中,我在IE上設置了禁用兼容模式。

任何幫助真的很感激。

編輯:這是我的代碼

<head> 
     <meta http-equiv="X-UA-Compatible" content="IE=Edge"/> 
     <link href="../styles/jquery-ui.css" rel="stylesheet" /> 
     <script src="../js/jquery-2.1.4.min.js" type="text/javascript"></scriptt> 
     <script src="../js/jquery-ui-1.11.4.min.js"></script> 
    </head> 
    <body> 
    <form id="form" runat="server" 
     <asp:Label ID="lblName" runat="server" >Name:</asp:Label>&nbsp; 
     <asp:TextBox ID="txtName" runat="server"></asp:TextBox>&nbsp; 
     <asp:Label ID="lblAddress" runat="server" >Name:</asp:Label>&nbsp; 
     <asp:TextBox ID="txtAddress" runat="server"></asp:TextBox>&nbsp; 
     <asp:CheckBox ID="chkNew" runat="server" Text="New?"></asp:CheckBox>&nbsp; 
     <asp:CheckBox ID="chkOld" runat="server" Text="Old?">&nbsp;                </asp:CheckBox>&nbsp; 
     </br> 
     <asp:Label ID="lblType" runat="server" >Type:</asp:Label>&nbsp; 
     <cc1:ELMSDropDownList ID="cboType" runat="server" AddEmpty="true" TableName="TYPE" 
      OnSelectedIndexChanged="cboType_SelectedIndexChanged" AutoPostBack="True" > 

     <asp:Button ID="cmdSave" runat="server" OnClick="cmdSave_Click" 
            Text=" Save "></asp:Button>&nbsp;&nbsp;&nbsp;  

    </form> 
    <script type="text/javascript"> 
    function Changecbx() 
    { 
     if (strType=="something") 
     { 
      $("#chkNew").prop("disabled", false); 
      $("#chkNew").prop("disabled", true); 
     } 
     return true; 
    } 

    function Validate() 
    { 
     //jquery validation   
    } 
    </body> 

這裏是我的身後

protected void Page_Load(object sender, System.EventArgs e) 
    { 
      if (!IsPostBack) 
     { 
      cmdSave.Attributes.Add("onclick", "return Validate()"); 
      cboType.Attributes.Add("onchange", "return Changecbx()"); 

      txtName. Attributes.Add("readonly", "readonly"); 
      txtAddress. Attributes.Add("readonly", "readonly"); 
     } 
    } 
+2

準確地說你的目標是什麼。 –

+1

你應該真的在做安全的東西服務器端。否則,人們可以直接關掉JS繞過我無法理解你的問題,你的安全功能 – Pete

+0

:*「誰擁有隻讀權限的用戶不能選擇和複製名稱的文本框和地址文本框」 * - 這聽起來像這樣它,你正在試圖解決這個問題,但是:*「名稱的文本框和地址文本框是隻讀用戶禁用」 * - 這使得它聽起來就像是故意的。你能澄清一下嗎? –

回答

1

代碼集這些輸入爲readonly,而不是disabled,但他們的風格讓他們照看殘疾。

+0

是的,我確實在頁面加載時將文本框更改爲只讀,但它們仍然不可選。我在表格點擊1〜2次的地方之前,我可以選擇文本 – Jenny

+0

@JennyLe - 沒有看到任何代碼,我無法解釋這一點。 – Igor

+0

我剛加了我的代碼,謝謝 – Jenny