|
|
|
|
|
|
HiddenField |
HiddenField (
string |
$name |
string |
$value |
mixed |
$validator = null, |
string |
$extra = null |
) |
Arguments:
Name |
Description |
$name |
Name of the field |
$value |
The value for the hidden 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. |
$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:
You can use this function to create a hidden field on the form.
Do not use this function if you want to add a value into the datababse! Use AddValue instead! This function is only usefull if you want to change the value of the hidden field with javascript or something like that.
Example
<?php
// include the class
include('FH3/class.FormHandler.php');
// make a new $form object
$form = new FormHandler;
// set a hidden field
$form -> hiddenField("language", "nl");
// a normal textfield
$form -> textField("Your name", "name", FH_STRING);
// button 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"] .",\n".
" your prefered language is " . $data["language"];
}
?>
|
See also: AddValue
Latest change: 05 March 10 / 08:32
Comments
|
|
|
|