|
|
|
|
|
|
TextField |
TextField (
string |
$title |
string |
$name |
mixed |
$validator = null, |
integer |
$size = 20, |
integer |
$maxlength = null, |
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. |
$size |
The size of the field. |
$maxlength |
The maximum allowed characters in this field. 0 is interpretated as no limit. |
$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 will create a textfield on the form.
Example
<?php
// include the class
include('FH3/class.FormHandler.php');
// make a new $form object
$form = new FormHandler();
// a textfield
$form->textField("Your name", "name", FH_STRING);
// submitbutton beneath it
$form->submitButton("Save");
// set the 'commit after form' function
$form->onCorrect("doRun");
// send the form to the screen
$form->flush();
// function to show a message
function doRun($data)
{
return "Hello ". $data["name"];
}
?>
|
Preview image
Latest change: 05 March 10 / 08:31
Comments
|
|
|
|