jQWidgets Forums
jQuery UI Widgets › Forums › Plugins › Validator, Drag & Drop, Sortable › validationSuccess event never triggered
Tagged: validator events
This topic contains 2 replies, has 2 voices, and was last updated by mikemazz 10 years, 6 months ago.
-
Author
-
Hi,
I am calling “validate” on a jqxValidator but it never seems to trigger a validationSuccess or validationError event. Here is my code.
$('#registrationForm').jqxValidator({ position: "right", animationDuration: 0, rules: [ { input: '#email', message: 'E-mail is required!', position: 'right', action: 'keyup, blur', rule: 'required' }, { input: '#email', message: 'Invalid e-mail!', position: 'right', action: 'keyup, blur', rule: 'email' }, { input: '#email', message: 'E-mail already exists!. Try again', action: 'keyup', rule: function (input, commit) { var data = { email: $("#email").val()}; var data = "xonaAction=userExists&" + $.param(data); $.ajax({ dataType: "json", url: "xona-evaluation-request.php", type: "POST", data: data, }) .done(function (data, status, xhr) { console.log("Validate user existence on server"); if (data['userExists'] == "true") { invalidLogin = 1; $("#registerButton").prop('disabled', true); $("#email").focus(); commit (false); } else { console.log("Username does NOT exist...continuing"); invalidLogin = 0; $("#registerButton").prop('disabled', false); console.log("Return true to rule"); commit (true); if (buttonClick == 1) { commit(true); //commit(true); buttonClick = 0; } } }) .fail(function(jqXHR, textStatus, errorThrown) { alert("Error: " + textStatus + ", " + errorThrown); commit (false); }) .always(function() { // nothing }) } }, { input: '#password', message: 'Unable to login. Invalid username or password', action: 'valuechanged', rule: function (input, commit) { if (failedLogin == 1) { console.log("Authentication failed"); failedLogin = 0; return false; } else { return true; } } },
Hello mikemazz,
To learn how to use these events, please look at: http://jsfiddle.net/jqwidgets/tkUmx/ and http://jsfiddle.net/jqwidgets/AUGwP/
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Peter,
I appreciate the links but I believe I understand how these event operate. I have this working in other areas when not using Ajax calls. You’ll notice that when the ajax query callback is executed “.done” the code sets the appropriate value for the rule return using commit(true|false). And there are log messages that indicate it’s getting into this block.
I don’t know where else to look for answers.
-
AuthorPosts
You must be logged in to reply to this topic.