FORMfields


FORMfields.fields.CreditCardDateField

Class CreditCardDateField

FormField
|
+--CreditCardDateField

public class CreditCardDateField
extends FormField

CreditCardDateField is a date field for credit card expiration dates.

Since:
FORMfields v1.0

Field Summary
mixed

$dateFormat

The date format used to format this date.

mixed

$month

The month field.

mixed

$subFieldDisplayValueSeparator

The string used to separate parts of the display value.

mixed

$subFieldSeparator

The string used to separate parts of the field.

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

CreditCardDateField(string name, string label, int required, string blankString, string dateFormat, string startDateString, string endDateString)

Creates a new CreditCardDateField.

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

Creates a new CreditCardDateField.

Method Summary
string

getDisplayValue()

Returns the date formatted by the dateFormat.

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

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 = "m/Y"

The date format used to format this date. Formats currently supported: m/y, m/Y, M/y, M/Y, m - M/Y, m - M/y See PHP's date() function for details on the date format.

Since:
FORMfields v3.0

month

public mixed $month = null

The month field.

Since:
FORMfields v1.0

subFieldDisplayValueSeparator

public mixed $subFieldDisplayValueSeparator = "-"

The string used to separate parts of the display value.

Since:
FORMfields v3.0

subFieldSeparator

public mixed $subFieldSeparator = " - "

The string used to separate parts of the field.

Since:
FORMfields v3.0

year

public mixed $year = null

The year field.

Since:
FORMfields v1.0

Constructor Detail

CreditCardDateField

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

Creates a new CreditCardDateField.

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", "Year". Defaulted to a single space.
dateFormat - The date format used to format this date. Formats currently supported: m/y, m/Y, M/y, M/Y, m - M/Y, m - M/y. See PHP's date() function for details on the date format.
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

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 as measured in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT). The day is defaulted to the 1st of the month.

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 expiration isn't in the past and that the date range is valid, 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

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, YYYY-M-D, MM-DD-YYYY. Valid separators: "/", "-", ".".
Since:
FORMfields v1.0

FORMfields