Yii2: how to use custom validation function for activeform?

前端 未结 12 1281
独厮守ぢ
独厮守ぢ 2020-12-25 14:18

In my form\'s model, I have a custom validation function for a field defined in this way

class SignupForm extends Model
{
    public function rules()
    {
          


        
12条回答
  •  温柔的废话
    2020-12-25 14:46

    You need to render the model from controller. Without initializing the model in view. And in the controller you need to call the validate function

提交回复
热议问题