Source of file NetefxValidatorRuleEMPTY.php
Size: 0,978 Bytes - Last Modified: 2021-12-23T10:02:33+00:00
/var/www/docs.ssmods.com/process/src/code/rules/NetefxValidatorRuleEMPTY.php
12345678910111213141516171819202122232425262728293031 | <?php /** * @package NetefxValidator * @author lx-berlin * @author zauberfisch */ class NetefxValidatorRuleEMPTY extends NetefxValidatorRule { /** * Empty Check on given field, returned true if the field is empty * @example $rule = new NetefxValidatorRuleEMPTY("SomeField", "this field should be empty"); * @param string $field name of the field * @param string $errorMsg the message to be displayed * @param string $errorMsgType the css class added to the field on validation error */ public function __construct($field, $errorMsg = null, $errorMsgType = 'error') { if ($errorMsg === null) $errorMsg = sprintf( _t('NetefxValidatorRuleEMPTY.ErrorMessage', '%s needs to be empty'), $field ); parent::__construct($field, $errorMsg, $errorMsgType, array()); } /** * @param array $data * @return boolean */ public function validate($data) { return ($data[$this->field] == ''); } } |