2012-07-05 68 views
0

我想用asp.net的jQuery表單嚮導來創建一個多步表單。我已經建立了表單,但是在驗證電子郵件時遇到問題。在進入下一步之前,我有兩個表單域通過電子郵件發送並確認應匹配的電子郵件。 我遇到的問題是我使用母版頁,所以我的控制ID正在重新命名。jquery窗體嚮導的validationOptions似乎在查看輸入控件的名稱屬性而不是ID,因此設置clientidmode的功能也不盡如人意。我正在尋找關於如何進行這項工作的建議或備選方案。jquery表單嚮導和驗證

這裏是我的標記

 <label for="txtconfemail">Confirm Email</label> 
    <asp:TextBox CssClass="input_field_12em" runat="server" ID="txtconfemail" ClientIDMode="Static"></asp:TextBox> 

這裏是我的JavaScript。此代碼只檢查所需(不等於),甚至不起作用。

   <script type="text/javascript"> 
    $(function() { 

     $("#myform").formwizard({ 
      formPluginEnabled: true, 
      validationEnabled: true, 
      focusFirstInput: true, 
      formOptions: { 
       success: function (data) { $("#status").fadeTo(500, 1, function() { $(this).html("You are now registered!").fadeTo(5000, 0); }) }, 
       beforeSubmit: function (data) { $("#data").html("data sent to the server: " + $.param(data)); }, 
       dataType: 'json', 
       resetForm: true 
      }, 
      validationOptions: { 
       rules: { 
        txtconfemail : { 
         required: true 

        } 
       }, 
       messages: { 
        txtemailconf: 
        { 
         required:"Email is required" 

        } 

       } 
      } 
     } 
      ); 
    }); 
</script> 

如果我ctl100 $ $搜索Maincontent更換txtconfemail txtemailconf,然後我的驗證被炒魷魚。

回答

0

嘗試使用

<%= txtconfemail.UniqueID %> 
+0

我已經嘗試過以及$(「#<%= txtemailconf.UniqueID%>」)由於其內部valdationOptions,我得到語法錯誤或預期標識符或字符串在<% – cableload 2012-07-05 20:26:38

+0

謝謝你,這工作..你指出我在正確的方向..''%% txtconfemail.UniqueID%>' – cableload 2012-07-05 20:31:05

+0

歡迎您。 – 2012-07-05 20:36:59