yii2 form validation not working
问题 How to know if the validation has been triggered in yii2 active form? I am using $('#formId').yiiActiveForm('validate', true); to validate the form, but it always returns undefined. 回答1: Trigger the form validation try this : var $form = $("#formId"), data = $form.data("yiiActiveForm"); $.each(data.attributes, function() { this.status = 3; }); $form.yiiActiveForm("validate"); I've create a function to validating active form in javascript, it will be return true/false. Maybe usefull : function