1
DaBoyz
Simple Link
  • 2004/1/9 0:12

  • DaBoyz

  • Just popping in

  • Posts: 79

  • Since: 2002/8/8 1


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 ...

2
Bazus
Re: Simple Link
  • 2004/1/9 0:16

  • Bazus

  • Not too shy to talk

  • Posts: 144

  • Since: 2002/9/23


could you show us a sample page for this button.

3
DaBoyz
Re: Simple Link
  • 2004/1/9 0:27

  • DaBoyz

  • Just popping in

  • Posts: 79

  • Since: 2002/8/8 1


unfortunately no because I use it on a module in development ...

But you just have to copy the code in a file and include it in a function to use it .... but include also the XOOPS_ROOT_PATH.'/class/xoopsformloader.php' file ...

I just test to add more than one button but that doesn't work for the moment ... a subtil error must exit ... ... but that disactived also the first button ...

Login

Who's Online

323 user(s) are online (197 user(s) are browsing Support Forums)


Members: 0


Guests: 323


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits