/** * Should the validation be run - based on whether new record or editing existing * * @return boolean */ protected function shouldValidateOn() { $params = $this->getParams(); $app = JFactory::getApplication(); $on = $params->get('validation_on', 'both'); $rowid = $this->elementModel->getFormModel()->getRowId(); if ($on === 'both') { return true; } if ($rowid === '' && $on === 'new') { return true; } if ($rowid !== '' && $on === 'edit') { return true; } return false; }