Wednesday 10 August 2016

Yii2 from events


In Yii2, below are the form events which we can make use it on front end / client side .

  • beforeValidate,
  • afterValidate,
  •  beforeValidateAttribute,
  • afterValidateAttribute,
  • beforeSubmit,
  •  ajaxBeforeSend,
  • ajaxComplete

Example usage:

$("#FORM-ID").on("afterValidate", function (event, messages) {

    // Now you can work with messages by accessing messages variable
 var attributes = $(this).data().attributes; // to get the list of attributes
    that has been passed in attributes property

  var settings = $(this).data().settings; // to get the settings

});

No comments:

Post a Comment