constructor HTML_QuickForm_date()

constructor HTML_QuickForm_date() – Class constructor

Synopsis

require_once 'HTML/QuickForm/date.php';

void constructor HTML_QuickForm_date::HTML_QuickForm_date ( string $elementName = null , mixed $elementLabel = null , array $options = array() , mixed $attributes = null )

Description

The $options parameter controls the element's appearance. It is an associative array of the form 'option name' => 'option value'.

'language'
Language code to use for display. Default is 'en'. date element supports many languages. If your one is not supported, send us the translation, we'll gladly include it.
'format'

Format string for the date, based on PHP's date() function. The following characters are recognised:


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
y => Two digit year
h => 12 hour format
H => 23 hour  format
i => Minutes
s => Seconds
a => am/pm
A => AM/PM
g => 12 hour format w/o leading zeroes
W => week of the year

Default is 'dMY'.

'minYear'

Minimum year in year select. Default is 2001.

'maxYear'

Maximum year in year select. Default is 2010.

On 'minYear' and 'maxYear'

When 'minYear' > 'maxYear' the years in the select will be displayed in descending order.

'addEmptyOption'

Should an empty option be added to the top of each select box? Default is FALSE. This may be set for individual fields also, if one passes an array of the form array('format char' => TRUE, ..., 'another format char' => FALSE)

'emptyOptionValue'

The value passed by the empty option. Default is ''.

'emptyOptionText'

The text displayed for the empty option. Default is ' '. This may be set for individual fields also, if one passes an array of the form array('format char' => 'some text', ..., 'another format char' => 'some other text')

'optionIncrement'

Step to increase the option values by. Works for 'i' and 's' formats currently. Default is array('i' => 1, 's' => 1).

Parameter

string $elementName

Element's name

mixed $elementLabel

Label(s) for an element

array $options

Options to control the element's display

mixed $attributes

Either a typical HTML attribute string or an associative array

Throws

throws no exceptions thrown

Note

This function can not be called statically.

Class for a group of elements used to input dates (and times). (Previous) A pseudo-element used for adding headers to form (Next)
Last updated: Sat, 16 Feb 2019 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report.
View this page in:
  • English

User Notes:

There are no user contributed notes for this page.