|
|
|
|
|
|
TimeField |
TimeField (
string |
$title |
string |
$name |
mixed |
$validator = null, |
boolean |
$required = true, |
integer |
$format = 24, |
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. |
$required |
When the field is required, the user has to select something. If the field is not required, the user can select empty values. |
$format |
Which time format should be used? Possible values: 12, 24. |
$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 TimeField.
Note: The steps of the minutes field (eg, 10, 20, 30 or 5, 10, 15, etc.) can be changed in the config file!
Example
<?php
// include the class
include('FH3/class.FormHandler.php');
// make a new formhandler object
$form = new FormHandler();
// a timefield
$form -> timeField("Time", "time");
// button beneath it
$form -> submitButton("Save");
// set the 'commit after form' function
$form -> onCorrect("doRun");
// send the form to the screen
$form -> flush();
// the function witch handles the code after the form
function doRun($data)
{
echo "Your time: " . $data["time"];
}
?>
|
Preview image
See also: DateField | jsDateField
Latest change: 11 July 11 / 09:26
Comments
|
|
|
|