Class: Zebra_Form_Textarea
source file: /includes/Textarea.php
Class Overview
XSS_Clean
|
--Zebra_Form_Control
|
--Zebra_Form_Textarea
Class for textarea controls
Author(s):
Copyright:
- (c) 2006 - 2016 Stefan Gabos
Class methods
constructor __construct()
void
__construct (
string
$id
,
[
string
$default
= '']
,
[
array
$attributes
= '']
)
Adds an <textarea> control to the form.
Do not instantiate this class directly! Use the add() method instead!
// create a new form
// add a textarea control to the form
$obj = $form->add('textarea', 'my_textarea');
// don't forget to always call this method before rendering the form
if ($form->validate()) {
// put code here
}
// output the form using an automatically generated template
$form->render();
Parameters:
string |
$id |
Unique name to identify the control in the form. The control's name attribute will be the same as the id attribute! This is the name to be used when referring to the control's value in the POST/GET superglobals, after the form is submitted. This is also the name of the variable to be used in custom template files, in order to display the control. // in a template file, in order to print the generated HTML
// for a control named "my_textarea", one would use:
echo $my_textarea;
|
string |
$default |
(Optional) Default value of the textarea. |
array |
$attributes |
(Optional) An array of attributes valid for textarea controls (rows, cols, style, etc) Must be specified as an associative array, in the form of attribute => value. // setting the "rows" attribute
$obj = $form->add(
'textarea',
'my_textarea',
'',
array(
'rows' => 10
)
);
See set_attributes() on how to set attributes, other than through the constructor. The following attributes are automatically set when the control is created and should not be altered manually:
id, name, class |
Top
method toHTML()
string
toHTML (
)
Generates the control's HTML code.
This method is automatically called by the render() method!
Tags:
return: |
The control's HTML code |
Top