|
|
|
 |
 |
 |
|
|
(Since version FH3 v1.2.6)
| TextSelectField |
TextSelectField (
| string |
$title |
| string |
$name |
| array |
$aOptions |
| mixed |
$validator |
| integer |
$size = 20, |
| integer |
$maxlength = null, |
| string |
$extra = null |
) |
Arguments:
| Name |
Description |
| $title |
Title of the field |
| $name |
Name of the field |
| $aOptions |
options for this fields select part |
| $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 |
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:
With this field you have the possibility to present a user a selection to put in the textfield or type there own value
Example
<?php
// include the formhandler
include( 'FH3/class.FormHandler.php' );
// create new formhandler object
$oForm = new Formhandler();
// set the options array
$aOptions = array( 'Red', 'Green' );
// new TextSelect field
$oForm->TextSelectField( 'Color', 'color', $aOptions );
// button to submit
$oForm->submitButton();
// what to do when the form is saved
$oForm->onCorrect( 'FH_RUN' );
// show the form
$oForm->Flush( );
// the function which is called when the data is saved
function FH_RUN( $aData )
{
echo 'You selected or typed value '. $aData['color'];
}
?>
|
Latest change: 11 July 11 / 09:25
Comments
|
|
|
|
|