below is code for my Custom Validator to see Atleast one option is selected in drop down menu....but when i try get the value of $attribute i am getting null Value but whereas the $validator has the value (of selected values)...Can anyone help me?
<?php
use Phalcon\Validation\Validator;
use Phalcon\Validation\ValidatorInterface;
use Phalcon\Validation\Message;
class MultiSelectValidator extends Validator implements ValidatorInterface {
public function __construct($options = null) {
parent::__construct($options);
$this->setOption("cancelOnFail", true);
}
public function validate(Phalcon\Validation $validator, $attribute) {
$array = $validator->getValue($attribute);//getting empty value
var_dump($validator)
if (empty($array)) {
$message = $this->getOption('message');
if (!$message) {
$message = "Select Atleast One Wallet";
}
$validator->appendMessage(new Message($message, $attribute, 'IsSelected'));
return FALSE;
}
return TRUE;
}
}