简体   繁体   中英

jquery form wizard and validation

i am trying to use the jquery form wizard with asp.net to create a multi step form. I have already built the form, but i am having problems during validation of emails. I have two form fields email and confirm email which should match before going to the next step. The problem i am having is I am using master pages and so my control id is getting renamed.The validationOptions of jquery form wizard seems to be looking at the name property of input control rather than ID, so setting clientidmode is not working as well. I am looking for suggestions or alternatives on how to make this work.

Here is my markup

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

Here is my javascript. This code only checks for required (not the equalTo) and even that does not work.

               <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>

If i replace txtemailconf with ctl100$MainContent$txtconfemail, then my validation gets fired.

尝试使用

    <%= txtconfemail.UniqueID %> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM