hi,
I created custom rule for Validation. But not working. I tried to log to system and everything is ok. Rule is working but appendMessage is not working...
Code
public function validate($attribute)
{
$logger = new FileAdapter("app/logs/validateelements.log");
$logger->begin();
$field = $this->getOption('field');
$fieldvalue = $attribute->getValue($field);
if (($fieldvalue != 'allowed') || ($fieldvalue != null)) {
$logger->alert("Rule working"); // Log working
$logger->commit();
$message = $this->getOption('message');
$type = "InvalidValue";
$this->appendMessage(new Message($message, $field, $type)); // This is not working
return false;
}
else
{
return true;
}
}
Why this is not working, anybody can explain me ?