jQuery deferred for forms validation.

If you want to use forms validation but send the data in your own ajax request it gets a bit tricky (Unless i’m doing it wrong :P )

Handy if you could fire validation manually and use the done/fail callbacks.

Something like,


.done(function() {

}).fail(function() {




$.fn.yiiactiveform.validate = function(form) {

  var $form = $(form), $form.data('settings'), validation = [];


  //Build an array of deferred validation functions.

  return $.when.apply(this, validation).fail(function() {

    //Update summary




The developer can then use the function manually.

$.fn.yiiactiveform.validate(myform).done(function() {

  //All is good


What exactly are you trying to do?

An ajax validation? And do X when it succeeds and Y when it fails?