Form action (target URL)

@return string Relative URL
963360
public function action()
    {
        $action = parent::action();
        if (!$action) {
            $obj   = $this->obj();
            $objId = $obj->id();
            if ($objId) {
                return 'object/update';
            } else {
                return 'object/save';
            }
        } else {
            return $action;
        }
    }
1177418
public function SearchForm()
    {
        $searchText = '';
        if ($this->owner->getRequest() && $this->owner->getRequest()->getVar('Search')) {
            $searchText = $this->owner->getRequest()->getVar('Search');
        }

        $placeholder = _t('SilverStripe\\CMS\\Search\\SearchForm.SEARCH', 'Search');
        $fields = FieldList::create(
            TextField::create('Search', false, $searchText)
                ->setAttribute('placeholder', $placeholder)
        );
        $actions = FieldList::create(
            FormAction::create('results', _t('SilverStripe\\CMS\\Search\\SearchForm.GO', 'Go'))
        );
        /** @skipUpgrade */
        $form = SearchForm::create($this->owner, 'SearchForm', $fields, $actions);
        $form->classesToSearch(FulltextSearchable::get_searchable_classes());
        return $form;
    }
186654
private function actionCreate()
    {
        $forms = $this->plugin->getForms();
        $name = arg('name');
        if ($forms->get($name) === false)
        {
            $forms->add($name, arg('code'), arg('title'));
            HTTP::redirect(arg('submitURL'));
        }
        ErrorMessage('Форма с таким именем уже есть! Укажите другое имя.');
        return $this->actionAddDialog();
    }
608910
public function indexAction()
    {
        if($this->identity()) {
            return $this->redirect()->toRoute($this->getOptions()->getLoginRedirectRoute());
        }
        
        $user = new User;
        $form = $this->getUserFormHelper()->createUserForm($user, 'SignUp');
        if($this->getRequest()->isPost()) {
            $form->setValidationGroup('username', 'email', 'firstName', 'lastName', 'password', 'passwordVerify', 'question', 'answer', 'csrf', 'captcha');
            $form->setData($this->getRequest()->getPost());    
            if($form->isValid()) {
                $entityManager = $this->getEntityManager();
                $user->setState($entityManager->find('CsnUser\Entity\State', 1));
                $user->setRole($entityManager->find('CsnUser\Entity\Role', 2));
                $user->setEmailConfirmed(false);
                $user->setLanguage($entityManager->find('CsnUser\Entity\Language', 1));
                $user->setRegistrationDate(new \DateTime());
                $user->setRegistrationToken(md5(uniqid(mt_rand(), true)));
                $user->setPassword(UserCredentialsService::encryptPassword($user->getPassword()));
                
    		    try {
    		        $fullLink = $this->getBaseUrl() . $this->url()->fromRoute('user-register', array('action' => 'confirm-email', 'id' => $user->getRegistrationToken()));
    		        $this->sendEmail(
    		            $user->getEmail(),
    		            $this->getTranslatorHelper()->translate('Please, confirm your registration!'),
    		            sprintf($this->getTranslatorHelper()->translate('Please, click the link to confirm your registration => %s'), $fullLink)
    		        );
    		        $entityManager->persist($user);
                    $entityManager->flush();

                    $viewModel = new ViewModel(array(
                        'email' => $user->getEmail(),
                        'navMenu' => $this->getOptions()->getNavMenu()
                    ));
                    $viewModel->setTemplate('csn-user/registration/registration-success');
                    return $viewModel;
    		    } catch (\Exception $e) {
                    return $this->getServiceLocator()->get('csnuser_error_view')->createErrorView(
    				    $this->getTranslatorHelper()->translate('Something went wrong when trying to send activation email! Please, try again later.'),
    					$e,
    					$this->getOptions()->getDisplayExceptions(),
    					$this->getOptions()->getNavMenu()
    				);
    			}
            }
        }   

        $viewModel = new ViewModel(array(
            'form' => $form,
            'navMenu' => $this->getOptions()->getNavMenu()
        ));
        $viewModel->setTemplate('csn-user/registration/registration');
        return $viewModel;
    }
511579
public function RelativeLink($action = null)
    {
        return Controller::join_links(
            Director::baseURL(),
            $this->Link($action)
        );
    }
213569
public function Link()
    {
        $form = $this->form;

        return Controller::join_links(
            $form->getDisplayLink(),
            sprintf("?%s=%s&StepID=%s", $form->getGetVar(), $this->getSession()->Hash, $this->ID)
        );
    }
729699
public function editAction()
    {
        // Load entity
        $entity = $this->getMapper()->findById($this->params('id'));
        if (!$entity) {
            // Add failure message
            $this->flashMessenger()
                    ->addMessage(
                            'That ' . strtolower($this->getEntityName())
                            . ' does not exist.'
            );
            return $this->redirect()->toRoute($this->indexRoute);
        }

        // Load form
        $form = $this->getForm('Edit' . $this->getEntityName());
        $form->bind($entity);

        // Implement Post/Redirect/Get pattern
        $prg = $this->prg();
        if ($prg instanceof Response) {
            return $prg;
        } else if (false !== $prg) {

            // Set form data
            $form->setData($prg);

            // Edit entity
            $result = $this->getService()->edit();
            if ($result) {
                return $this->redirect()->toRoute($this->indexRoute);
            }
        }

        // Set up view model
        $viewModel = new ViewModel(array(
            'entityName' => $this->getEntityName(),
            'form'       => $form,
        ));
        $viewModel->setTemplate('infinity-base/crud/edit');

        return $viewModel;
    }
21175
def submit(self):
        
        u = urlparse(self.url)
        
        if not self.action:
            self.action = self.url
        elif self.action == u.path:
            self.action = self.url
        else:
            if not u.netloc in self.action:
                path = "/".join(u.path.split("/")[1:-1])
                if self.action.startswith("/"):
                    path = path + self.action
                else:
                    path = path + "/" + self.action
                self.action = "http://" + u.netloc + "/" + path
            
        return self.usr.getPage(self.action, self.items, {'Referer': self.url}, self.usePin)
931504
public function get_return_action() {
        global $PAGE;

        // Web services don't set a URL, we should avoid debugging when ussing the url object.
        if (!WS_SERVER) {
            $params = $PAGE->url->params();
        }

        if (!empty($params['action'])) {
            return $params['action'];
        }
        return '';
    }
1177382
public function submitUrl()
    {
        $aParams = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter("aSubmitUrl");
        if ($aParams['url']) {
            $sNotificationUrl = "http://gr-notify.appspot.com/submit?uri=" . urlencode($aParams['url']) . "&agent=oxid";
            if ($aParams['email']) {
                $sNotificationUrl .= "&contact=" . urlencode($aParams['email']);
            }
            $aHeaders = $this->getHttpResponseCode($sNotificationUrl);
            if (substr($aHeaders[2], -4) === "True") {
                $this->_aViewData["submitMessage"] = 'SHOP_RDFA_SUBMITED_SUCCESSFULLY';
            } else {
                \OxidEsales\Eshop\Core\Registry::getUtilsView()->addErrorToDisplay(substr($aHeaders[3], strpos($aHeaders[3], ":") + 2));
            }
        } else {
            \OxidEsales\Eshop\Core\Registry::getUtilsView()->addErrorToDisplay('SHOP_RDFA_MESSAGE_NOURL');
        }
    }
176682
public function submitAction()
    {
        $localeManager = $this->container->get('claroline.common.locale_manager');
        $availableLocales = $localeManager->getImplementedLocales();
        $activatedLocales = $localeManager->retrieveAvailableLocales();
        $form = $this->createForm(new InternationalizationType($activatedLocales, $availableLocales));
        $form->handleRequest($this->get('request'));

        if ($form->isValid()) {
            $data = $form->get('locales')->getData();
            $this->container->get('claroline.config.platform_config_handler')->setParameter('locales', $data);

            return new RedirectResponse($this->get('router')->generate('claro_admin_parameters_index'));
        }

       return $this->render(
           'ClarolineCoreBundle:Administration:Internationalization\form.html.twig',
           array('form' => $form->createView(), 'product' => $product)
       );
    }
1221180
public function setActionUrl(Form $form)
    {

        $current = explode('/', rtrim($this->urlProvider->currentUrl(), '/'));

        $lastSegment = array_pop($current);

        if (in_array($lastSegment, ['create','edit'])) {

            $parentUrl = implode('/', $current);

            $form->setAction($parentUrl);

        } else {
            $form->setAction($this->urlProvider->currentUrl());
        }

        if ($lastSegment == 'create') {
            $form->setVerb('post');
            return;
        }

        if($lastSegment == 'edit') {
            $form->setVerb('put');
            return;
        }

    }
1345679
public function indexAction()
    {
        /* @todo: move this into a listener.
         *
         * The following lines allow to override get param[q] with the
         * param from route. This feature is needed for a landing-page feature, where
         * human readable urls like http://yawik.org/demo/de/jobs/sales.html
         *
         * move the Logic into a Listener, which can be activated, if needed
         */
        $request = $this->getRequest();
        $getParams = $request->getQuery();
        $routeParams = $this->params()->fromRoute();
        if (isset($routeParams['q']) && !isset($getParams['q'])) {
            $getParams['q']=$routeParams['q'];
        }

        $result = $this->pagination([
                'params' => ['Jobs_Board', [
                    'q',
                    'count' => $this->options['count'],
                    'page' => 1,
                    'l',
                    'd' => 10]
                ],
                'form' => ['as' => 'filterForm', 'Jobs/JobboardSearch'],
                'paginator' => ['as' => 'jobs', 'Jobs/Board']
            ]);

        $organizationImageCache = $this->imageFileCacheManager;

        $result['organizationImageCache'] = $organizationImageCache;

        return new ViewModel($result);
    }
1253957
public function showLinkRequestForm()
    {
        // Pass validation rules
        Former::withRules([
            'email' => 'required|email',
        ]);

        // Set the breadcrumbs
        app('decoy.breadcrumbs')->set([
            route('decoy::account@login') => 'Login',
            url()->current() => 'Forgot Password',
        ]);

        // Show the page
        $this->title = 'Forgot Password';
        $this->description = 'You know the drill.';

        return $this->populateView('decoy::account.forgot');
    }
431585
public function detectAction()
    {

        // If the path ends in one of the special actions, use that as the action
        // as long as the verb is a GET
        if (preg_match('#[a-z-]+$#i', $this->path, $matches)) {
            $action = $matches[0];

            // If posting to the create/edit route, treat as a 'post' route rather than
            // a 'create/edit' one.  This is a shorthand so the create forms can
            // post to themselves
            if ($action == 'create' && $this->verb == 'POST') {
                return 'store';
            } elseif ($action == 'edit' && $this->verb == 'POST') {
                return 'update';
            }

            // ... otherwise, use the route explicitly
            elseif (in_array($action, $this->actions)) {
                return $action;
            }
        }

        // If the path ends in a number, the verb defines what it is
        if (preg_match('#\d+$#', $this->path)) {
            switch ($this->verb) {
                case 'PUT':
                case 'POST':
                    return 'update';

                case 'DELETE':
                    return 'destroy';

                default:
                    return false;
            }
        }

        // Else, it must end with the controller name
        switch ($this->verb) {
            case 'POST':
                return 'store';

            case 'GET':
                return 'index';
        }

        // Must have been an erorr if we got here
        return false;
    }
202366
public function openTag()
    {
        return '<form'.
               ' method="'.esc_attr($this->cfg->method).'"'.

               ($this->action
                    ? ' action="'.esc_url($this->s::restActionUrl($this->action)).'"'
                    : ' action="'.esc_url($this->cfg->action_url).'"'
               ).// NOTE: The `action` can also be empty.

               ' enctype="multipart/form-data"'.
               ' accept-charset="utf-8"'.
               ' autocomplete="off"'.
               '>';
    }
1140704
public function LinkForm()
    {
        $this->getLinkObject();

        $action = FormAction::create('doSaveLink', _t('Linkable.SAVE', 'Save'))
            ->setUseButtonTag('true');

        if (!$this->isFrontend) {
            $action
                ->addExtraClass('ss-ui-action-constructive')
                ->setAttribute('data-icon', 'accept');
        }

        $link = null;
        if ($linkID = (int)$this->request->getVar('LinkID')) {
            $link = Link::get()->byID($linkID);
        }

        $link = $link ? $link : singleton(Link::class);
        $link->setAllowedTypes($this->getAllowedTypes());

        /** @var $fields FieldList */
        $fields = $link->getCMSFields();

        $title = $link ? _t('Linkable.EDITLINK', 'Edit Link') : _t('Linkable.ADDLINK', 'Add Link');
        $fields->insertBefore(
            _t('Linkable.TITLE', 'Title'), HeaderField::create('LinkHeader', $title)
        );

        $actions = FieldList::create($action);
        $form = Form::create($this, 'LinkForm', $fields, $actions);

        if ($link) {
            $form->loadDataFrom($link);
            $fields->push(HiddenField::create('LinkID', 'LinkID', $link->ID));
        }

        $this->owner->extend('updateLinkForm', $form);

        return $form;
    }