本文整理汇总了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;
}
示例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();
}
}
示例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();
}
示例4: alterForm
function alterForm(HTMLForm $form)
{
$form->setMethod('GET');
$form->setAction($this->getPageTitle()->getLocalURL());
$form->setSubmitText($this->msg('centralauth-rename-viewprogress')->text());
}
示例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);