FORMfields


FORMfields.fields.CurrencyField

Class CurrencyField

FormField
|
+--TextField
|
+--FloatField
|
+--CurrencyField

public class CurrencyField
extends FloatField

CurrencyField is a field for editing an amount of money in any specified currency.

Since:
FORMfields v2.0

Field Summary
mixed

$sign

The clear text sign.

mixed

$signHtml

The HTML that appears to the left of the field value.

Fields inherited from FORMfields.fields.FloatField
REGEX_FLOAT, maxValue, minValue
Fields inherited from FORMfields.fields.TextField
maxLength, minLength, size
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

CurrencyField(string name, string label, int required, int maxLength, int minLength, int size, mixed maxValue, mixed minValue, mixed signHtml, float the)

Creates a new CurrencyField.

__construct(string name, string label, int required, int maxLength, int minLength, int size, mixed maxValue, mixed minValue, mixed signHtml, float the)

Creates a new CurrencyField.

Method Summary
string

format(string str, string signHtml)

A static method that returns str as a formatted currency value.

string

getDisplayValue()

Returns the display value of this field.

string

getEditableFieldTag()

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

boolean

isValid()

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

Methods inherited from FORMfields.fields.FloatField
isValid
Methods inherited from FORMfields.fields.TextField
getEditableFieldTag, isValid
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

sign

public mixed $sign

The clear text sign.

Since:
FORMfields v2.0

signHtml

public mixed $signHtml

The HTML that appears to the left of the field value. See HTML Special Characters

Since:
FORMfields v3.0

Constructor Detail

CurrencyField

public CurrencyField(string name, string label, int required, int maxLength, int minLength, int size, mixed maxValue, mixed minValue, mixed signHtml, float the)

Creates a new CurrencyField.

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
maxLength - the maximum permitted length of the text
minLength - the minimum permitted length of the text
size - the display length of the text or null
the - maximum value permitted
the - minimum value permitted
Pagam:
string signHtml the HTML that appears to the left of the field value. See HTML Special Characters.
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

format

public string format(string str, string signHtml)

A static method that returns str as a formatted currency value. Note: the decimal places will be padded to 2 digits.

Parameters:
str - a decimal number to format
signHtml - the HTML that appears to the left of the field value
Returns:
the formatted currency value
Since:
FORMfields v3.0

getDisplayValue

public string getDisplayValue()

Returns the display value of this field. For example, the field may have a value of "2127348943" and its display value could be "212-734-8943".

Returns:
the display value of this field
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 v2.0

isValid

public boolean isValid()

Checks for field errors detected by this field, including a check for blank. This method ensures that the value has 2 decimal places at most. 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

FORMfields