|
|
|
|
|
|
(Since version FH3 v1.2.12)
jsDateTextField |
jsDateTextField (
string |
$title |
string |
$name |
mixed |
$validater = null, |
string |
$mask = null, |
boolean |
$bParseOtherPresentations = false, |
string |
$extra = null, |
boolean |
$bIncludeJS = true |
) |
Arguments:
Name |
Description |
$title |
The title of the field |
$name |
The name of the field |
$validater |
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.
(NOTE: the date is automaticly checked for a correct combination) |
$mask |
The mask which will be used to lay out the date fields. If no mask is given, the default mask is loaded which is set in the config file with the var FH_DATETEXTFIELD_DEFAULT_DISPLAY.
In the mask the following placeholders are replaced:
d = day (2 digits with leading zeros)
D = day
m = month (2 digits with leading zeros)
M = month
y = year (two digits)
Y = year (four digits)
The date will be changed to the correct format when it's being saved into the database. The date will have the same format as given in the mask when it's returned to the user (in your onSaved or OnCorrect function) |
$bParseOtherPresentations |
try to parse other presentations of dateformat |
$extra |
This can be extra information which will be included in the fields html tag. You can add for example some CSS or javascript. |
$bIncludeJS |
Should we include the js file (only needed once on a page) |
Description:
With this function you can create a date text field with a jsCalendar so that the user can easily select a date.
The usage is exactly the same as a normal DateTextField, only this one comes with a js calendar!
Example
<?php
// include the class
include('FH3/class.FormHandler.php');
// make a new form object
$oForm = new FormHandler();
// make the datefield
$oForm -> jsDateTextField("Birthdate", "birthdate");
// button beneath it
$oForm -> submitButton("Save");
// set the 'commit after form' function
$oForm -> onCorrect("doRun");
// send the form to the screen
$oForm -> flush();
// the function witch handles the code after the form
function doRun($aData)
{
// show the birthdate
echo "Your birthday is ". $aData["birthdate"];
}
?>
|
Preview image
See also: DateField | jsDateField | DateTextField
Latest change: 11 July 11 / 09:26
Comments
|
|
|
|