Login Retreive lost passwordRegister
Search

Manual  /  Functions  /  Fields  /  TextArea

TextArea
TextArea (
string $title
string $name
mixed $validator = null,
integer $cols = 40,
integer $rows = 7,
string $extra = null 
)

Arguments:

Name Description
$title Title of the field
$name Name of the field
$validator This can either be the name of your own validation function or the constant name of a predefined validator function. For more information about validators see Validators.
It is also possible to use a method as a validation function. In this case you should pass an array where the first item is the object and the second item the name of the method.
$cols The width of the textarea.
$rows The height of the textarea
$extra This can be extra information which will be included in the fields html tag. You can add for example some CSS or javascript.

Description:

This function generates a TextArea on the form

Note: When submitting very much data please dont use the FH_TEXT validator. The validator is to time/memory expensive and submitting will fail. For small and normal amounts of data you can just use FH_TEXT.

Example

<?php

// include the class
include('FH3/class.FormHandler.php');

// new $form object
$form = new FormHandler();

// the textarea
$form -> textArea("Message""message"FH_TEXT);

// button beneath it
$form -> submitButton("Save");

// set the 'commit after form' function
$form -> onCorrect("doRun");

// flush the form
$form -> flush();

// function to show the selected items
function doRun($data
{
    return 
"Your message: <br>\n".
    
nl2br($data["message"]);
}

?>

Preview image

preview image

Latest change: 05 March 10 / 08:32

Comments

powered by PHP-GLOBE   © 2004 - 2024 FormHandler. All rights reserved.   -   Open source license