Tramite PEAR QuickForm
è possibile inserire un campo data direttamenteo all'interno delle proprie form,
$form->addElement('date', 'mydate', 'Scegli la data');
è possibile inoltre specificare determinati parametri per personalizzare tale campo.
$option = array (
'language' => 'it',
'maxYear' => 2020
);
$form->addElement('date', 'mydate', 'Scegli la data', $options);
ecco quali sono tutte le possibili opzioni...
var $_options = array(
'language' => 'en',
'format' => 'dMY',
'minYear' => 2001,
'maxYear' => 2010,
'addEmptyOption' => false,
'emptyOptionValue' => '',
'emptyOptionText' => ' ',
'optionIncrement' => array('i' => 1, 's' => 1)
);
è inoltre possibile modificare il formato col quale deve essere visualizzata la form utilizzando la sintassi standard offerta dal PHP
D = Short names of days l = Long names of days d = Day numbers M = Short names of months F = Long names of months m = Month numbers Y = Four digit year h = 12 hour format H = 23 hour format i = Minutes s = Seconds a = am/pm A = AM/PM
aggiungere il default value è un pò macchinoso, infatti bisogna:
$defaults['month_year'] = array('M'=> date('m'), 'Y'=>date('Y'));
$form-> setDefaults ($defaults);
$form-> addElement ('date', 'month_year', 'Date:',
array('format'=> 'MY', 'minYear'=>2000, 'maxYear'=>date('Y')+1));
This will display a date chooser defaulting to current month and year.
lib/WikiUser.php:59: Notice[8]: Only variables should be assigned by reference
lib/Template.php:112: Notice[8]: Only variables should be assigned by reference
lib/Template.php:114: Notice[8]: Only variables should be assigned by reference
lib/Template.php (In template 'html'):112: Notice[8]: Only variables should be assigned by reference
lib/Template.php (In template 'html'):114: Notice[8]: Only variables should be assigned by reference
lib/Template.php (In template 'html'):112: Notice[8]: Only variables should be assigned by reference
lib/Template.php (In template 'html'):114: Notice[8]: Only variables should be assigned by reference
lib/Template.php (In template 'body') (In template 'html'):112: Notice[8]: Only variables should be assigned by reference
lib/Template.php (In template 'body') (In template 'html'):114: Notice[8]: Only variables should be assigned by reference
lib/Template.php (In template 'top') (In template 'body') (In template 'html'):112: Notice[8]: Only variables should be assigned by reference
lib/Template.php (In template 'top') (In template 'body') (In template 'html'):114: Notice[8]: Only variables should be assigned by reference
lib/Template.php (In template 'body') (In template 'html'):112: Notice[8]: Only variables should be assigned by reference
lib/Template.php (In template 'body') (In template 'html'):114: Notice[8]: Only variables should be assigned by reference
lib/CachedMarkup.php (In template 'browse') (In template 'body') (In template 'html'):427: Notice[8]: Only variables should be assigned by reference