1
le="color: #000000"><?php class XoopsFormButtonLink extends XoopsFormElement { /** * Value * @var string * @access private */ var $_value; /** * Constructor * * @param string $caption Caption * @param string $name * @param string $value * @param string $link Link on click */ function XoopsFormButtonLink($caption, $name, $value="", $link=""){ $this->setCaption($caption); $this->setName($name); $this->setValue($value); $this->setLink($link); } /** * Get the initial value * * @return string */ function getValue(){ return $this->_value; } /** * Set the initial value * * @return string */ function setValue($value){ $this->_value = $value; } /** * Get the initial link * * @return string */ function getLink(){ return $this->_link; } /** * Set the initial value * * @return string */ function setLink($link){ $this->_link = $link; } /** * prepare HTML for output * * @return string */ function render(){ return "<input type='button' class='formButton' name='".$this->getName()."' id='".$this->getName()."' value='".$this->getValue()."'".$this->getExtra()." onclick="document.location='".$this->getLink()."' />"; } }
With this you could had a button that only be a link but I use it with this (for example):
[...]
$buttons->addElement(new XoopsFormButtonLink('','','RETURN','index.php'));
$form->addElement($buttons);
$form->display();
Display just a button to return at the index.php page ...