yii\validators\RequiredValidator::init PHP Method

init() public method

public init ( )
    public function init()
    {
        parent::init();
        if ($this->message === null) {
            $this->message = $this->requiredValue === null ? Yii::t('yii', '{attribute} cannot be blank.') : Yii::t('yii', '{attribute} must be "{requiredValue}".');
        }
    }

Usage Example

 public function init()
 {
     parent::init();
     //todo using strict options
     $this->when = function () {
         $oth_val = $this->targetModel->{$this->targetAttribute};
         return $this->isEmpty(is_string($oth_val) ? trim($oth_val) : $oth_val);
     };
     //todo using strict options
     $id = Html::getInputId($this->targetModel, $this->targetAttribute);
     $this->whenClient = "function(){return \$('#{$id}').prop('disabled');}";
 }
All Usage Examples Of yii\validators\RequiredValidator::init