/** * Called during validation operations, before validation. Please note that custom * validation rules can be defined in $validate. * * @param array $options Options passed from Model::save(). * @return bool True if validate operation should continue, false to abort * @link http://book.cakephp.org/2.0/en/models/callback-methods.html#beforevalidate * @see Model::save() */ public function beforeValidate($options = array()) { $displayTypes = array_keys(self::$displayTypes); $this->validate = Hash::merge($this->validate, array('frame_key' => array('notBlank' => array('rule' => array('notBlank'), 'message' => __d('net_commons', 'Invalid request.'))), 'display_type' => array('inList' => array('rule' => array('inList', $displayTypes), 'message' => __d('net_commons', 'Invalid request.'), 'allowEmpty' => true)), 'display_digit' => array('naturalNumber' => array('rule' => array('naturalNumber', true), 'message' => __d('net_commons', 'Invalid request.')), 'numeric' => array('rule' => array('range', self::DISPLAY_DIGIT_MIN - 1, self::DISPLAY_DIGIT_MAX + 1), 'message' => __d('net_commons', 'Invalid request.'))))); return parent::beforeValidate($options); }
/** * Called during validation operations, before validation. Please note that custom * validation rules can be defined in $validate. * * @param array $options Options passed from Model::save(). * @return bool True if validate operation should continue, false to abort * @link http://book.cakephp.org/2.0/en/models/callback-methods.html#beforevalidate * @see Model::save() */ public function beforeValidate($options = array()) { $this->validate = Hash::merge($this->validate, array('block_key' => array('notBlank' => array('rule' => array('notBlank'), 'message' => __d('net_commons', 'Invalid request.'), 'required' => true, 'on' => 'update')), 'count' => array('naturalNumber' => array('rule' => array('naturalNumber', true), 'message' => __d('net_commons', 'Invalid request.'), 'allowEmpty' => true)), 'count_start' => array('naturalNumber' => array('rule' => array('naturalNumber', true), 'message' => __d('net_commons', 'Invalid request.'), 'allowEmpty' => true)))); return parent::beforeValidate($options); }