Hi,
Am running custom validation rule to check a related table value, its works with now issue, but the error msg is not showing, so this bug, or am doing something wrong?
// the rule
[
'customer_id',
'validateCustomer',
'skipOnEmpty' => false,
'skipOnError' => false,
'message' => 'Customer validation error!'
]
/*
* Custom validetor for the customer id
*/
public function validateCustomer($attribute, $params) {
$cID = Customer::find ()->where ( [
'id' => $this->customer_id
] )->one ();
if (! $cID) {
$this->addError ( 'customer_id', 'Customer validation error!' );
Yii::trace ( "Error: Customer id: " . $this->customer_id, 'Customer Validation' );
} else {
Yii::trace ( "Found: Customer id: " . $this->customer_id, 'Customer Validation' );
}
}
Also I can get the field value in the function or in the log, however its working!
Thanks,