FORMfields


FORMfields.fields.DateTimeField

Class DateTimeField

FormField
|
+--DateTimeField

public class DateTimeField
extends FormField

FormField is the base class of a form field.

Since:
FORMfields v2.0

Field Summary
mixed

$date

The date sub field.

mixed

$dateFormat

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

mixed

$endDateTimeString

The latest date and time permitted in the form: "YYYY-MM-DD HH:MM:SS", "YYYY-MM-DD HH:MM" or "YYYYMMDDHHMMSS"

mixed

$startDateTimeString

The earliest date and time permitted in the form: "YYYY-MM-DD HH:MM:SS", "YYYY-MM-DD HH:MM" or "YYYYMMDDHHMMSS"

mixed

$subFieldSeparator

The string used to separate parts of the field.

mixed

$subFieldValueSeparator

A string separator used to separate the values of the sub fields.

mixed

$time

The time sub 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

DateTimeField(string name, string label, int required, string blankString, string startDateTimeString, string endDateTimeString)

Creates a new DateTimeField.

__construct(string name, string label, int required, string blankString, string startDateTimeString, string endDateTimeString)

Creates a new DateTimeField.

Method Summary
void

getCurrentDateTime()

Sets this field's value to the current date and time.

string

getDisplayValue()

Returns the date formatted by the dateFormat.

int

getUnixTimestamp()

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

boolean

isValid()

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

void

setToCurrentDateTime()

Sets this field's value to the current date and time.

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

date

public mixed $date = null

The date sub field.

Since:
FORMfields v2.0

dateFormat

public mixed $dateFormat = "n/j/Y g:i A"

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

endDateTimeString

public mixed $endDateTimeString = null

The latest date and time permitted in the form: "YYYY-MM-DD HH:MM:SS", "YYYY-MM-DD HH:MM" or "YYYYMMDDHHMMSS"

Since:
FORMfields v2.0

startDateTimeString

public mixed $startDateTimeString = null

The earliest date and time permitted in the form: "YYYY-MM-DD HH:MM:SS", "YYYY-MM-DD HH:MM" or "YYYYMMDDHHMMSS"

Since:
FORMfields v2.0

subFieldSeparator

public mixed $subFieldSeparator = "    "

The string used to separate parts of the field.

Since:
FORMfields v3.0

subFieldValueSeparator

public mixed $subFieldValueSeparator = " "

A string separator used to separate the values of the sub fields.

Since:
FORMfields v3.0

time

public mixed $time = null

The time sub field.

Since:
FORMfields v2.0

Constructor Detail

DateTimeField

public DateTimeField(string name, string label, int required, string blankString, string startDateTimeString, string endDateTimeString)

Creates a new DateTimeField.

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.
startDateTimeString - The earliest date permitted in the form: "YYYY-MM-DD HH:MM:SS", "YYYY-MM-DD HH:MM" or "YYYYMMDDHHMMSS"
endDateTimeString - The latest date permitted in the form: "YYYY-MM-DD HH:MM:SS", "YYYY-MM-DD HH:MM" or "YYYYMMDDHHMMSS"
See Also:
FORM_FIELD_REQUIRED
FORM_FIELD_NOT_REQUIRED
FORM_FIELD_LOOKS_REQUIRED
FORM_FIELD_REQUIRED_NO_LOOK
Since:
FORMfields v2.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

getCurrentDateTime

public void getCurrentDateTime()

Sets this field's value to the current date and time.

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

getDisplayValue

public string getDisplayValue()

Returns the date formatted by the dateFormat.

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

getUnixTimestamp

public int getUnixTimestamp()

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

Returns:
the date and time as measured in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT)
Since:
FORMfields v3.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 v2.0

setToCurrentDateTime

public void setToCurrentDateTime()

Sets this field's value to the current date and time.

Since:
FORMfields v2.0

setValue

public void setValue(string value)

Sets the value of this form field.

Parameters:
value - the new value of this field. Valid formats: YYYY-MM-DD HH:MM:SS, YYYY-MM-DD HH:MM, YYYYMMDDHHMMSS.
Since:
FORMfields v1.0

FORMfields