From Genitura
<?php
/**
* Textarea
*
* manage HTML textarea
*
* @package form
* @author Julien Halle <julienhalle@heptacube.com>
* @version Geniruta - 05/01/2009
*/
class Textarea
{
var $name;
var $class;
var $on_change;
var $value;
var $rows;
var $cols;
function Textarea($name,$class='',$value='') {
$this->name = $name;
$this->class = $class;
$this->value = $value;
} // constructor
function set_value($value = "---") {
$this->value = $value;
}
function set_on_change($script){
$this->on_change = $script;
}
function set_size($rows, $cols){
if (is_numeric($rows) && is_numeric($cols)) {
$this->rows = $rows;
$this->cols = $cols;
} else {
die('invalid call to set_size($int,$int)');
}
}
function get_html() {
$str = '<textarea name="'.$this->name.'" id="'.$this->name.'" ';
if ($this->on_change) {
$str .= 'onChange="'.$this->on_change.'" ';
}
if ($this->rows) {
$str .= 'rows="'.$this->rows.'" ';
}
if ($this->cols) {
$str .= 'cols="'.$this->cols.'" ';
}
if ($this->class) {
$str .= 'class="'.$this->class.'" ';
}
$str .= '>';
$str .= $this->value.'</textarea>';
return $str;
}
}
?>