Success
@param Form $form
@throws \Propel\Runtime\Exception\PropelException
181944
public function success(Form $form) : void
    {
        if ($this->presenter->isAjax())
        {
            $values = $form->getValues();

            try
            {
                $this->onPageManager->savePrimary($this->activePage, $values->title, $values->description, $values->indexingType, $values->isCanonical);

                $this->presenter->notificationAjax(
                    'On-Page faktory',
                    'On-Page faktory byly úspěšně upraveny.',
                    'success',
                    FALSE
                );

                $this->onSave();
            }
            catch (DatabaseException $exception)
            {
                $this->presenter->notificationAjax(
                    'Chyba',
                    $exception->getMessage(),
                    'error'
                );
            }
        }
    }
470870
protected function updateErrorBox(Form $form, $errors)
    {
        foreach ($form->getChildrenByType('\\Zepi\\Web\\UserInterface\\Form\\ErrorBox', true) as $errorBox) {
            $errorBox->updateErrorBox($form, false, $errors);
        }
    }
720471
function startForm(&$form){
        global $PAGE;
        $this->_reqHTML = $form->getReqHTML();
        $this->_elementTemplates = str_replace('{req}', $this->_reqHTML, $this->_elementTemplates);
        $this->_advancedHTML = $form->getAdvancedHTML();
        $this->_collapseButtons = '';
        $formid = $form->getAttribute('id');
        parent::startForm($form);
        if ($form->isFrozen()){
            $this->_formTemplate = "\n<div id=\"$formid\" class=\"mform frozen\">\n{collapsebtns}\n{content}\n</div>";
        } else {
            $this->_formTemplate = "\n<form{attributes}>\n\t<div style=\"display: none;\">{hidden}</div>\n{collapsebtns}\n{content}\n</form>";
            $this->_hiddenHtml .= $form->_pageparams;
        }

        if ($form->is_form_change_checker_enabled()) {
            $PAGE->requires->yui_module('moodle-core-formchangechecker',
                    'M.core_formchangechecker.init',
                    array(array(
                        'formid' => $formid
                    ))
            );
            $PAGE->requires->string_for_js('changesmadereallygoaway', 'moodle');
        }
        if (!empty($this->_collapsibleElements)) {
            if (count($this->_collapsibleElements) > 1) {
                $this->_collapseButtons = $this->_collapseButtonsTemplate;
                $this->_collapseButtons = str_replace('{strexpandall}', get_string('expandall'), $this->_collapseButtons);
                $PAGE->requires->strings_for_js(array('collapseall', 'expandall'), 'moodle');
            }
            $PAGE->requires->yui_module('moodle-form-shortforms', 'M.form.shortforms', array(array('formid' => $formid)));
        }
        if (!empty($this->_advancedElements)){
            $PAGE->requires->js_call_amd('core_form/showadvanced', 'init', [$formid]);
        }
    }
321984
public function settingsFormSucceeded(Form $form, ArrayHash $values): void
	{
		$this->configurator->logo = $values->logo;
		$this->configurator->title = $values->title;
		$this->configurator->keywords = $values->keywords;
		$this->configurator->description = $values->description;
		$this->flashNotifier->success('webManager.web.settings.saved');

		if ($this->isAjax()) {
			$this->redrawControl('settings');
		} else {
			$this->redirect('default');
		}
	}
1281846
public function passwordFormSucceeded(Form $form, ArrayHash $values): void
	{
		if ($values->generatePassword) {
			$password = Random::generate($this->minPasswordLength, $this->passwordChars);
		} else {
			$password = $values->password;
		}

		$this->currentUser->setPassword($password);

		$this->orm->persistAndFlush($this->currentUser);

		if ($this->configurator->sendChangePassword) {
			$this->mailer->sendNewPassword($this->currentUser->email, $this->currentUser->username, $password);
		}

		$this->flashNotifier->success('cms.user.passwordChanged');
		$this->restoreBacklink();
	}
1304073
protected function workout(FormInterface $form)
    {
        foreach (self::$workers as $worker) {
            call_user_func_array(
                [$worker, 'execute'],
                [$form, $this->parsedData]
            );
        }
    }
518862
public function passwordFormSucceeded(Form $form, ArrayHash $values): void
	{
		try {
			$this->profile->setPassword($values->password, $values->oldPassword);
			$this->orm->persistAndFlush($this->profile);
			$this->flashNotifier->success('cms.user.passwordChanged');
		} catch (AuthenticationException $e) {
			$form->addError('cms.user.incorrectPassword');
		}
		if ($this->isAjax()) {
			$this->redrawControl('passwordForm');
		}
	}
376216
protected function crudCreateIsSubmitted(FormInterface $form)
    {
        $buttonName = $this->crudCreateButtonName();
        if (null !== $buttonName && !$form->get($buttonName)->isClicked()) {
            return false;
        }

        return true;
    }
535493
public function handleForm(FormEvent $event): void
    {
        $admin = $event->getAdmin();
        $action = $admin->getAction();

        if ('delete' === $action->getName()) {
            if (!$admin->hasForm('delete')) {
                return;
            }
            $form = $admin->getForm('delete');
            $this->handleDeleteForm($event->getRequest(), $form, $admin);
        }
    }
957533
public function handleBatchDeleteForm(FormInterface $form, $entities, $successMessage = 'crud.action.batch_delete.success')
    {
        if (!$form->isValid()) {
            $message = implode(PHP_EOL, array_map(function (FormError $error) {
                return $error->getMessage();
            }, iterator_to_array($form->getErrors(true))));
            $this->flashNotifier->error($message);

            return false;
        }
        foreach ($entities as $entity) {
            $this->em->remove($entity);
        }

        $this->em->flush();

        $this->flashNotifier->success($successMessage);

        return true;
    }
58716
public function setForm(ControlCollection $form = null): Control
    {
        $this->control->setForm($form);

        return parent::setForm($form);
    }
378756
public function setForm($form)
    {
        // Associate Form Instance (via parent):
        
        parent::setForm($form);
        
        // Associate Rules with Fields:
        
        foreach ($this->rules as $fieldName => $rules) {
            
            if ($field = $this->getDataField($fieldName)) {
                
                foreach ($rules as $rule) {
                    $rule->setField($field);
                }
                
            }
            
        }
        
        // Associate Backend with Self:
        
        $this->backend->setFrontend($this);
        
        // Initialise Backend:
        
        $this->backend->doInit();
        
        // Define Form Classes:
        
        if ($classes = $this->getClassesForForm($form)) {
            
            foreach ($classes as $class) {
                $form->addExtraClass($class);
            }
            
        }
        
        // Define Form Attributes:
        
        if ($attributes = $this->getAttributesForForm($form)) {
            
            foreach ($attributes as $key => $value) {
                $form->setAttribute($key, $value);
            }
            
        }
        
        // Answer Self:
        
        return $this;
    }
722629
protected function prepare_fields( Form $form ) {
		foreach ( $form->all() as $field ) {
			/* @var $field \WPLibs\Form\Field */
			if ( ! $field->should_show() ) {
				return;
			}

			$_section = $field->get_option( 'section' );

			if ( ! $_section || ! isset( $this->sections[ $_section ] ) ) {
				continue;
			}

			$this->sections[ $_section ]->fields[] = $field;
		}
	}
678752
public static function execute(ContainerInterface $form, array $data)
    {
        self::$form = $form;
        $hasElements = isset($data['elements']) && is_array($data['elements']);
        if (!$hasElements) {
            return;
        }

        foreach ($data['elements'] as $name => $element) {
            $input = self::create($element);
            self::setSettings($input, $element);
            $input->setName($name);
            self::populateInputs($input, $element);
            $form->add($input);
        }
    }
71480
public function navButtonSubmit(array &$form, FormStateInterface &$form_state) {
    $storage = $form_state->getStorage();
    // Save steps values to storage.
    if ($form_state->getValue('location')) {
      $storage['location'] = $form_state->getValue('location');
    }
    if ($form_state->getValue('type')) {
      $storage['type'] = $form_state->getValue('type');
    }
    $form_state->setStorage($storage);
    $form_state->setRebuild();
  }
969675
public function startForm(HTML_QuickForm2 $form)
    {
        $this->formId = $form->getId();
        $this->rules[$this->formId] = array();
    }
977057
public function updateEditForm($form)
    {
        if ($this->isAssetAdmin() && $this->hasSecureAssets()) {
            
            if (($record = $form->getRecord()) && $record instanceof Folder) {
                
                if ($field = $form->Fields()->dataFieldByName('ViewerGroups')) {
                    
                    // Create Form Object:
                    
                    $dummy = Form::create(
                        $this->owner,
                        'EditForm',
                        FieldList::create(),
                        FieldList::create()
                    );
                    
                    // Populate Form Data:
                    
                    $dummy->loadDataFrom($record);
                    
                    // Define Form Action (allows ViewerGroups field to work in asset EditForm):
                    
                    $dummy->setFormAction(
                        sprintf(
                            '%s/field/File/item/%d/ItemEditForm',
                            $form->FormAction(),
                            $record->ID
                        )
                    );
                    
                    // Update Field Object:
                    
                    $field->setForm($dummy);
                    
                }
                
            }
            
        }
    }