Fixed validation beforeValidate and afterValidate.

Fixed validation beforeValidate and afterValidate in yii.activeForm.js.
Description in #3139