yii2: FR: Validation, send error message to other attribute

Sometimes i need when some attribute going invalid, the error message sending to other attribut. We can add property sendErrorTo (or someting else) to class Validator, so we can do this

public function rules()
{
    return [
        ['date', 'date', 'timestampAttribute' => 'date_timestamp'],
        ['date_timestamp', 'compare', 'operator' => '>', 'compareValue' => time(), 'sendErrorTo' => 'date'],
    ];
}

I want when date_timestamp is invalid, the attribute date that going error because only date attribute that appear in form. Sorry for RIP english.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 22 (21 by maintainers)

Most upvoted comments

Well, it’s a different case. In that case it’s not possible to do with a client validation. In case of setting error to another attribute it should be possible.