Only have validation fire when one button is clicked using LiveValidation?

I have an aspx page which has a few textboxes used to change a password. The user types in their current password along with a new and a confirmed new password. I have a cancel button and a change button. If cancel is clicked, nothing happens which is what it is supposed to do. If change is clicked and validation is passed, it should change the password and if it does not validate, it should display errors. The problem I am getting is that I am using the onlyOnSubmit : true with the LiveValidation js file which I got from www.livevalidation.com and I only want the validation to fire when the Change button is clicked. Here is the script I am using:

$(function() {

var currentPassword = new LiveValidation('<%= txtCurrentPassword.ClientID %>', 
                                         {validMessage: " " });
currentPassword.add(Validate.Presence, 
                                         {onlyOnSubmit: true, 
                                          failureMessage: "Required" });

var newPassword = new LiveValidation('<%= txtNewPassword.ClientID %>',
                                     {validMessage: " " });
newPassword.add(Validate.Presence, 
                {onlyOnSubmit: true, 
                 failureMessage: "Required" });

var confirmNewPassword = new LiveValidation('<%= txtConfirmNewPassword.ClientID %>',
                                            {validMessage: " " });

confirmNewPassword.add(Validate.Presence,
                       {onlyOnSubmit: true, 
                        failureMessage: "Required" });

confirmNewPassword.add(Validate.Confirmation, 
                       {onlyOnSubmit: true, 
                        match: '<%= txtNewPassword.ClientID %>',
                        failureMessage: "Your passwords don't match!" });

});

Answers


I have the exact same problem with a page that contains a contact form (in the body) and a search box (in the header). Clicking the "search" button fires the form validation.


Need Your Help

Grid View Items contents in xaml (windows store app)

c# xaml gridview windows-store-apps

how can I get to the contents of the clicked grid Item in a grid view ... for example the grid item has a textbox ... how could I get the contents of this textbox when the gridview Item is clicked ...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.