FORMfields


FORMfields.fields.DateField

Class DateField

FormField
|
+--DateField

public class DateField
extends FormField

DateField a three part date field with a popup date calendar.

Since:
FORMfields v1.0

Field Summary
mixed

$dateFormat

The date format used when displaying value of this date to the user.

mixed

$day

The day field.

mixed

$endDateString

The latest date permitted in the form "YYYY-MM-DD"

mixed

$month

The month field.

mixed

$showCalendar

True if an icon for the popup calendar should be displayed.

mixed

$startDateString

The earliest date permitted in the form "YYYY-MM-DD"

mixed

$subFieldDisplayValueSeparator

The string used to separate parts of the display value.

mixed

$year

The year field.

Fields inherited from FORMfields.fields.FormField
autoPropagate, data, disableEnterHandler, displayValuesOnNewLine, editable, enabled, endingString, enterTabHandler, enterTabs, error, extraHtml, fieldBelowLabel, formError, help, hidden, htmlify, id, isData, label, labelForId, multiValues, name, required, subFieldDisplayValueSeparator, subFieldSeparator, subFieldValueSeparator, subFields, subFieldsCannotBeEmpty, trimWhitespace, validators, value, valueIsHtml
Constructor Summary

DateField(string name, string label, int required, string blankString, string startDateString, string endDateString)

Creates a new DateField.

__construct(string name, string label, int required, string blankString, string startDateString, string endDateString)

Creates a new DateField.

Method Summary
void

getCurrentDate()

Sets this field's value to the current date.

int

getDaysInMonth(int month, int year)

Returns the number of days in the specified month.

string

getDisableFieldJs()

Returns JavaScript code to disable the input field portion of this field during run-time.

string

getDisplayValue()

Returns the date formatted by the dateFormat.

string

getEditableFieldTag()

Returns the HTML used to display the input portion of this field.

int

getUnixTimestamp()

Returns the date as measured in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT).

string

getValue()

Returns the value of this form field in the form "YYYY-MM-DD".

boolean

isValid()

Checks for field errors detected by this field, including a check for blank.

void

setDate(array date)

Sets this field's value according to the date array returned by PHP's getdate() function.

void

setToCurrentDate()

Sets this field's value to the current date.

void

setValue(string value)

Sets the value of this form field.

Methods inherited from FORMfields.fields.FormField
addFieldValidator, addSubField, checkForBlank, clearValue, disable, formatRequestParameter, formatText, getButtonClicked, getData, getDbValue, getDisableFieldJs, getDisableJs, getDisableLabelJs, getDisplayFieldTag, getDisplayHtmlValue, getDisplayLabelTag, getDisplayValue, getEditable, getEditableFieldTag, getEditableLabelTag, getEnabled, getError, getExtraHtml, getFieldTag, getFormError, getHelp, getHelpTag, getHidden, getHiddenFieldTag, getId, getIsData, getIsHidden, getLabel, getLabelHtml, getLabelTag, getName, getOrNull, getParameter, getRawDbValue, getRequired, getValue, isBlank, isEmpty, isValid, setAutoPropagate, setData, setDbValue, setDisplayValuesOnNewLine, setEditable, setEnabled, setEndingString, setError, setExtraHtml, setFieldBelowLabel, setFormError, setHelp, setHidden, setHtmlify, setId, setIsData, setIsHidden, setLabel, setName, setRequired, setTrimWhitespace, setValue, setValueIsHtml, validate

Field Detail

dateFormat

public mixed $dateFormat = "n/j/Y"

The date format used when displaying value of this date to the user. See PHP's date function for all the supported formats.

Since:
FORMfields v3.0

day

public mixed $day = null

The day field.

Since:
FORMfields v1.0

endDateString

public mixed $endDateString = null

The latest date permitted in the form "YYYY-MM-DD"

Since:
FORMfields v1.0

month

public mixed $month = null

The month field.

Since:
FORMfields v1.0

showCalendar

public mixed $showCalendar = true

True if an icon for the popup calendar should be displayed.

Since:
FORMfields v1.0

startDateString

public mixed $startDateString = null

The earliest date permitted in the form "YYYY-MM-DD"

Since:
FORMfields v1.0

subFieldDisplayValueSeparator

public mixed $subFieldDisplayValueSeparator = "-"

The string used to separate parts of the display value.

Since:
FORMfields v3.0

year

public mixed $year = null

The year field.

Since:
FORMfields v1.0

Constructor Detail

DateField

public DateField(string name, string label, int required, string blankString, string startDateString, string endDateString)

Creates a new DateField.

Parameters:
name - the name of the form field. This value must not be a SQL reserved word and should follow all the standard variable naming conventions in PHP.
label - this form field's label. The label is the printable text that is typically displayed on the left side of the field.
required - Sets whether the field must be filled in and whether it looks like it must be filled in: FORM_FIELD_REQUIRED, FORM_FIELD_NOT_REQUIRED, FORM_FIELD_LOOKS_REQUIRED or FORM_FIELD_REQUIRED_NO_LOOK
blankString - the default display value for each drop down field or a single space for "Month", "Day", "Year". Defaulted to a single space.
startDateString - The earliest date permitted in the form "YYYY-MM-DD"
endDateString - The latest date permitted in the form "YYYY-MM-DD"
See Also:
FORM_FIELD_REQUIRED
FORM_FIELD_NOT_REQUIRED
FORM_FIELD_LOOKS_REQUIRED
FORM_FIELD_REQUIRED_NO_LOOK
Since:
FORMfields v1.0
Deprecated:
deprecated as this constructor syntax is not expected in PHP 5 - will be removed once PHP 5 becomes a minimum requirement for FORMfields

Method Detail

getCurrentDate

public void getCurrentDate()

Sets this field's value to the current date.

Since:
FORMfields v2.0
Depcrecated:
use setToCurrentDate() instead. Will be removed in the next release of FORMfields.

getDaysInMonth

public int getDaysInMonth(int month, int year)

Returns the number of days in the specified month.

Parameters:
month - the month: 1-12
year - the year is two or four digits
Returns:
the number of days in the specified month
Since:
FORMfields v1.0

getDisableFieldJs

public string getDisableFieldJs()

Returns JavaScript code to disable the input field portion of this field during run-time.

Returns:
JavaScript code to disable the input field portion of this field during run-time
Since:
FORMfields v3.0

getDisplayValue

public string getDisplayValue()

Returns the date formatted by the dateFormat.

Returns:
the date formatted by the dateFormat.
Since:
FORMfields v2.0

getEditableFieldTag

public string getEditableFieldTag()

Returns the HTML used to display the input portion of this field.

Returns:
the HTML used to display the input portion of this field
Since:
FORMfields v1.0

getUnixTimestamp

public int getUnixTimestamp()

Returns the date as measured in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT).

Returns:
the date as measured in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT)
Since:
FORMfields v3.0

getValue

public string getValue()

Returns the value of this form field in the form "YYYY-MM-DD".

Returns:
the value of this form field
Since:
FORMfields v1.0

isValid

public boolean isValid()

Checks for field errors detected by this field, including a check for blank. This method ensures that the date is valid and that it falls within the permissible range, if a date range was specified. If an error is detected, the setError() method is called to set the appropriate error message.

Returns:
true if there is an error or false otherwise
Since:
FORMfields v1.0

setDate

public void setDate(array date)

Sets this field's value according to the date array returned by PHP's getdate() function.

Parameters:
date - the date array returned by PHP's getdate() function
Since:
FORMfields v2.0

setToCurrentDate

public void setToCurrentDate()

Sets this field's value to the current date.

Since:
FORMfields v3.0

setValue

public void setValue(string value)

Sets the value of this form field. Valid formats: YYYY-MM-DD, YYYY-M-D, MM-DD-YYYY. Valid separators: "/", "-", ".".

Parameters:
value - the new value of this field
Since:
FORMfields v1.0

FORMfields