FORMfields


FORMfields.fields.RadioButtonField

Class RadioButtonField

FormField
|
+--RadioButtonField

public class RadioButtonField
extends FormField

RadioButton a field for displaying a group of radio button boxes where only one box can be selected at a time.

Since:
FORMfields v1.0

Field Summary
mixed

$OTHER_STRING_MAX_SIZE

The maximum length of the "Other" string.

mixed

$cols

The number of columns used to display the radio button choices.

mixed

$includeOtherChoice

True if the other field should be displayed so that the user can enter an other string when their desired selection doesn't exist.

mixed

$options

A string array of options associated with each radio button.

mixed

$otherChoice

The sub field the edits the other string.

mixed

$radioButtons

An array of radio button sub fields.

mixed

$rows

The number of rows used to display the radio button choices.

mixed

$subFieldsCannotBeEmpty

True if an empty sub field constitutes an invalid value.

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

RadioButtonField(string name, string label, int required, array options, int rows, int cols, boolean includeOtherChoice)

Creates a new RadioButtonField.

__construct(string name, string label, int required, array options, int rows, int cols, boolean includeOtherChoice)

Creates a new RadioButtonField.

Method Summary
string

getDisplayValue()

Returns the display value of this field.

string

getEditableFieldTag()

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

void

getParameter()

Retrieves the posted field value.

the

getSingleButtonEditableFieldTag(FormField radioButton)

Returns the HTML to display the editable portion of a radio button.

the

getSingleButtonFieldTagForLabel(string label)

Returns the HTML to display the field of a single radio button.

the

getSingleButtonLabelTag(RadioButtonField radioButton)

Returns the HTML to display the label of a single radio button.

the

getSingleButtonLabelTagForLabel(string label)

Returns the HTML to display the label of a single radio button.

the

getSingleButtonTag(RadioButtonField radioButton)

Returns the HTML to display a single radio button.

the

getSingleButtonTagForLabel(string label)

Returns the HTML to display a single radio button.

array

getValue()

Returns the value of this form field.

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

OTHER_STRING_MAX_SIZE

public mixed $OTHER_STRING_MAX_SIZE = 40

The maximum length of the "Other" string.

Since:
FORMfields v3.0

cols

public mixed $cols = null

The number of columns used to display the radio button choices.

Since:
FORMfields v3.0

includeOtherChoice

public mixed $includeOtherChoice = false

True if the other field should be displayed so that the user can enter an other string when their desired selection doesn't exist.

Since:
FORMfields v3.0

options

public mixed $options = null

A string array of options associated with each radio button.

Since:
FORMfields v1.0

otherChoice

public mixed $otherChoice

The sub field the edits the other string.

Since:
FORMfields v3.0

radioButtons

public mixed $radioButtons

An array of radio button sub fields.

Since:
FORMfields v3.0

rows

public mixed $rows = null

The number of rows used to display the radio button choices.

Since:
FORMfields v3.0

subFieldsCannotBeEmpty

public mixed $subFieldsCannotBeEmpty = false

True if an empty sub field constitutes an invalid value.

Since:
FORMfields v3.0

Constructor Detail

RadioButtonField

public RadioButtonField(string name, string label, int required, array options, int rows, int cols, boolean includeOtherChoice)

Creates a new RadioButtonField.

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
options - A string array of options associated with each radio button
rows - The number of rows used to display the radio button choices or if null is supplied each button will appear on it's own line. The rows restriction is ranked higher than the cols restriction.
cols - The number of columns used to display the radio button choices. Defaulted to 1.
includeOtherChoice - True if the other field should be displayed so that the user can enter an other string when their desired selection doesn't exist
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 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 v3.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

getParameter

public void getParameter()

Retrieves the posted field value. In other words, sets this field value using the appropriate values in $_REQUEST.

Since:
FORMfields v1.0

getSingleButtonEditableFieldTag

public the getSingleButtonEditableFieldTag(FormField radioButton)

Returns the HTML to display the editable portion of a radio button.

Parameters:
radioButton - the form field used to generate the radio button
Returns:
HTML to display the editable portion of a radio button
Since:
FORMfields v3.0

getSingleButtonFieldTagForLabel

public the getSingleButtonFieldTagForLabel(string label)

Returns the HTML to display the field of a single radio button.

Parameters:
label - the label of a radio button to display
Returns:
HTML to display a single radio button field
Since:
FORMfields v3.0

getSingleButtonLabelTag

public the getSingleButtonLabelTag(RadioButtonField radioButton)

Returns the HTML to display the label of a single radio button.

Parameters:
radioButton - a radio button to display
Returns:
HTML to display a single radio button
Since:
FORMfields v3.0

getSingleButtonLabelTagForLabel

public the getSingleButtonLabelTagForLabel(string label)

Returns the HTML to display the label of a single radio button.

Parameters:
label - the label of a radio button to display
Returns:
HTML to display a single radio button label
Since:
FORMfields v3.0

getSingleButtonTag

public the getSingleButtonTag(RadioButtonField radioButton)

Returns the HTML to display a single radio button.

Parameters:
radioButton - a radio button to display
Returns:
HTML to display a single radio button
Since:
FORMfields v3.0

getSingleButtonTagForLabel

public the getSingleButtonTagForLabel(string label)

Returns the HTML to display a single radio button.

Parameters:
label - the label of a radio button to display
Returns:
HTML to display a single radio button
Since:
FORMfields v3.0

getValue

public array getValue()

Returns the value of this form field.

Returns:
a string array of options
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 if the other choice is checked, that a value for other is supplied. 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 selected value or other string
Since:
FORMfields v1.0

FORMfields