Backend\Modules\Profiles\Actions\EditGroup::validateForm PHP Méthode

validateForm() private méthode

Validate the form.
private validateForm ( )
    private function validateForm()
    {
        // is the form submitted?
        if ($this->frm->isSubmitted()) {
            // cleanup the submitted fields, ignore fields that were added by hackers
            $this->frm->cleanupFields();
            // get fields
            $txtName = $this->frm->getField('name');
            // name filled in?
            if ($txtName->isFilled(BL::getError('NameIsRequired'))) {
                // name already exists?
                if (BackendProfilesModel::existsGroupName($txtName->getValue(), $this->id)) {
                    // set error
                    $txtName->addError(BL::getError('GroupNameExists'));
                }
            }
            // no errors?
            if ($this->frm->isCorrect()) {
                // build item
                $values['name'] = $txtName->getValue();
                // update values
                BackendProfilesModel::updateGroup($this->id, $values);
                // trigger event
                BackendModel::triggerEvent($this->getModule(), 'after_edit_group', array('item' => $values));
                // everything is saved, so redirect to the overview
                $this->redirect(BackendModel::createURLForAction('Groups') . '&report=group-saved&var=' . rawurlencode($values['name']) . '&highlight=row-' . $this->id);
            }
        }
    }