public function validate() { if (!parent::validate()) { return false; } $existing = fx::data('lang_string')->where('string', $this['string'])->where('dict', $this['dict'])->where('id', $this['id'], '!=')->all(); foreach ($existing as $double) { if ($double['string'] == $this['string']) { //fx::log('nop', $double['string'], $this['string']); $this->validate_errors[] = 'String "' . $this['string'] . '" already exists in the "' . $this['dict'] . '" dictionary'; return false; } //fx::log('double by case?', $this, $double); } return true; }
public function validate() { $fields = $this->getComponent()->getAllFields(); foreach ($fields as $f) { if ($f['is_required'] && !$this[$f['keyword']]) { $this->invalid($f['name'] . ': ' . fx::lang('This field is required'), $f['keyword']); } } return parent::validate(); }