當前位置: 首頁>>代碼示例>>PHP>>正文


PHP HTMLForm::setAction方法代碼示例

本文整理匯總了PHP中HTMLForm::setAction方法的典型用法代碼示例。如果您正苦於以下問題:PHP HTMLForm::setAction方法的具體用法?PHP HTMLForm::setAction怎麽用?PHP HTMLForm::setAction使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在HTMLForm的用法示例。


在下文中一共展示了HTMLForm::setAction方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getForm

 /**
  * Get the HTMLForm to control behavior
  * @return HTMLForm|null
  */
 protected function getForm()
 {
     $this->fields = $this->getFormFields();
     // Give hooks a chance to alter the form, adding extra fields or text etc
     Hooks::run('ActionModifyFormFields', array($this->getName(), &$this->fields, $this->page));
     $form = new HTMLForm($this->fields, $this->getContext(), $this->getName());
     $form->setSubmitCallback(array($this, 'onSubmit'));
     $title = $this->getTitle();
     $form->setAction($title->getLocalURL(array('action' => $this->getName())));
     // Retain query parameters (uselang etc)
     $params = array_diff_key($this->getRequest()->getQueryValues(), array('action' => null, 'title' => null));
     if ($params) {
         $form->addHiddenField('redirectparams', wfArrayToCgi($params));
     }
     $form->addPreText($this->preText());
     $form->addPostText($this->postText());
     $this->alterForm($form);
     // Give hooks a chance to alter the form, adding extra fields or text etc
     Hooks::run('ActionBeforeFormDisplay', array($this->getName(), &$form, $this->page));
     return $form;
 }
開發者ID:paladox,項目名稱:2,代碼行數:25,代碼來源:FormAction.php

示例2: execute

 function execute($par)
 {
     $this->setHeaders();
     $this->outputHeader();
     $request = $this->getRequest();
     $propname = $request->getVal('propname', $par);
     $dbr = wfGetDB(DB_SLAVE);
     $res = $dbr->select('page_props', 'pp_propname', '', __METHOD__, array('DISTINCT', 'ORDER BY' => 'pp_propname'));
     foreach ($res as $row) {
         $propnames[$row->pp_propname] = $row->pp_propname;
     }
     $form = new HTMLForm(array('propname' => array('type' => 'selectorother', 'name' => 'propname', 'options' => $propnames, 'default' => $propname, 'label-message' => 'pageswithprop-prop', 'required' => true)), $this->getContext());
     $form->setMethod('get');
     $form->setAction($this->getTitle()->getFullUrl());
     $form->setSubmitCallback(array($this, 'onSubmit'));
     $form->setWrapperLegend($this->msg('pageswithprop-legend'));
     $form->addHeaderText($this->msg('pageswithprop-text')->parseAsBlock());
     $form->setSubmitTextMsg('pageswithprop-submit');
     $form->prepareForm();
     $form->displayForm(false);
     if ($propname !== '' && $propname !== null) {
         $form->trySubmit();
     }
 }
開發者ID:Grprashanthkumar,項目名稱:ColfusionWeb,代碼行數:24,代碼來源:SpecialPagesWithProp.php

示例3: showActivateDeactivateForm

 protected function showActivateDeactivateForm($tag, $activate)
 {
     $actionStr = $activate ? 'activate' : 'deactivate';
     $user = $this->getUser();
     if (!$user->isAllowed('managechangetags')) {
         throw new PermissionsError('managechangetags');
     }
     $out = $this->getOutput();
     // tags-activate-title, tags-deactivate-title
     $out->setPageTitle($this->msg("tags-{$actionStr}-title"));
     $out->addBacklinkSubtitle($this->getPageTitle());
     // is it possible to do this?
     $func = $activate ? 'canActivateTag' : 'canDeactivateTag';
     $result = ChangeTags::$func($tag, $user);
     if (!$result->isGood()) {
         $out->addWikiText("<div class=\"error\">\n" . $result->getWikiText() . "\n</div>");
         if (!$result->isOK()) {
             return;
         }
     }
     // tags-activate-question, tags-deactivate-question
     $preText = $this->msg("tags-{$actionStr}-question", $tag)->parseAsBlock();
     $fields = [];
     // tags-activate-reason, tags-deactivate-reason
     $fields['Reason'] = ['type' => 'text', 'label' => $this->msg("tags-{$actionStr}-reason")->plain(), 'size' => 50];
     $fields['HiddenTag'] = ['type' => 'hidden', 'name' => 'tag', 'default' => $tag, 'required' => true];
     $form = new HTMLForm($fields, $this->getContext());
     $form->setAction($this->getPageTitle($actionStr)->getLocalURL());
     $form->tagAction = $actionStr;
     $form->setSubmitCallback([$this, 'processTagForm']);
     // tags-activate-submit, tags-deactivate-submit
     $form->setSubmitTextMsg("tags-{$actionStr}-submit");
     $form->addPreText($preText);
     $form->show();
 }
開發者ID:claudinec,項目名稱:galan-wiki,代碼行數:35,代碼來源:SpecialTags.php

示例4: alterForm

 function alterForm(HTMLForm $form)
 {
     $form->setMethod('GET');
     $form->setAction($this->getPageTitle()->getLocalURL());
     $form->setSubmitText($this->msg('centralauth-rename-viewprogress')->text());
 }
開發者ID:NDKilla,項目名稱:mediawiki-extensions-CentralAuth,代碼行數:6,代碼來源:SpecialGlobalRenameProgress.php

示例5: HTMLForm

require './HTMLRadio.php';
require './HTMLAnchor.php';
?>

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <?php 
$form = new HTMLForm('form_1');
$divNome = new HTMLDIV('d_nome');
$form->setMethod('POST');
$form->setAction($_SERVER['SCRIPT_NAME']);
$label = new HTMLLabel('Nome', 'i_nome');
$inputNome = new HTMLInput('text', 'i_nome');
$inputNome->addAttribute('value', "Evandro Pereira de Lacerda");
$inputNome->addAttribute('size', 60);
$text = new HTMLTextNode('Nome');
$label->addChild($inputNome);
$divNome->addChild($label);
//***************************************************
$divNascimento = new HTMLDIV('d_nasc');
$labelNascimento = new HTMLLabel("Data de Nascimento", 'i_nasc');
$nascimento = new HTMLInput('date', 'i_nasc');
$nascimento->addAttribute('size', 25);
$nascimento->addClass('input_n');
$nascimento->addClass('input_md');
$labelNascimento->addChild($nascimento);
開發者ID:evandrolacerda,項目名稱:HTMLTags,代碼行數:31,代碼來源:index.php


注:本文中的HTMLForm::setAction方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。