开发者

jQuery Validation on a subset of fields

I am wanting to use jquery validation on one form that contains 2 submit buttons. each submit button submits its own set of fields. when i submit either of the submit buttons - jquery is validating both sets of fields.

Is there a way to setup the validation logic to handle its own set of fields on the one form?

this is how I have setup validation:

$(document)开发者_如何学JAVA.ready(function() {
    $("#form").validate({ errorElement: "div" });
});

markup:

<table>
<tr>
    <td>
        <label>Current Email Address</label><br />
        <label id="lblCurrentEmail" runat="server"></label><br /><br />                
        <label>New Email Address</label><br />
        <input id="txtNewEmail" name="txtNewEmail" type="text" /><br />
        <a id="btnUpdateEmail" class="roundButton" onclick="return updateEmail()">Update</a>
    </td>
    <td>
        <label>Update Password</label><br />
        <input id="txtNewPassword1" name="txtNewPassword1" type="password" /><br /><br />
        <label>Confirm Password</label><br />
        <input id="txtNewPassword2" name="txtNewPassword2" type="password" /><br />
        <a id="btnUpdatePassword" class="roundButton" onclick="return changePassword()">Update</a>
    </td>
</tr>
</table>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜