本文整理汇总了PHP中HTML_QuickForm2::getElementById方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML_QuickForm2::getElementById方法的具体用法?PHP HTML_QuickForm2::getElementById怎么用?PHP HTML_QuickForm2::getElementById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML_QuickForm2
的用法示例。
在下文中一共展示了HTML_QuickForm2::getElementById方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setDefaultAction
/**
* Sets the default action invoked on page-form submit
*
* This is necessary as the user may just press Enter instead of
* clicking one of the named submit buttons and then no action name will
* be passed to the script.
*
* @param string Default action name
* @param string Path to a 1x1 transparent GIF image
* @return object Returns the image input used for default action
*/
public function setDefaultAction($actionName, $imageSrc = '')
{
require_once 'HTML/QuickForm2/Controller/DefaultAction.php';
if (0 == count($this->form)) {
$image = $this->form->appendChild(new HTML_QuickForm2_Controller_DefaultAction($this->getButtonName($actionName), array('src' => $imageSrc)));
// replace the existing DefaultAction
} elseif ($image = $this->form->getElementById('_qf_default')) {
$image->setName($this->getButtonName($actionName))->setAttribute('src', $imageSrc);
// Inject the element to the first position to improve chances that
// it ends up on top in the output
} else {
$it = $this->form->getIterator();
$it->rewind();
$image = $this->form->insertBefore(new HTML_QuickForm2_Controller_DefaultAction($this->getButtonName($actionName), array('src' => $imageSrc)), $it->current());
}
return $image;
}