FORMfields


FORMfields.fields.CheckboxGroupField

Class CheckboxGroupField

FormField
|
+--CheckboxGroupField

public class CheckboxGroupField
extends FormField

CheckboxGroupField is a field for editig a group of checkboxes. This field even allows you to format the group of checkboxes into several rows and columns to minimize the length of your form.

Since:
FORMfields v3.0

Field Summary
mixed

$checkboxes

An array of checkbox sub fields.

mixed

$cols

The number of columns into which to format the checkboxes.

mixed

$includeOtherChoice

True if the other choice should displayed.

mixed

$multiValues

True if this is a multiple value field.

mixed

$otherChoice

A sub field for the other choice string.

mixed

$rows

The number of rows into which to format the checkboxes.

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

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

Creates a new CheckboxGroupField.

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

Creates a new CheckboxGroupField.

Method Summary
string

getEditableFieldTag()

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

void

getParameter()

Retrieves the posted field value.

the

getSingleCheckboxTag(CheckboxField checkbox)

Returns the HTML to display a single checkbox.

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

setDbValue(string value)

Sets the database value of this field.

void

setValue(array values, mixed value)

Sets the value of this 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

checkboxes

public mixed $checkboxes

An array of checkbox sub fields.

Since:
FORMfields v3.0

cols

public mixed $cols = null

The number of columns into which to format the checkboxes.

Since:
FORMfields v3.0

includeOtherChoice

public mixed $includeOtherChoice = false

True if the other choice should displayed.

Since:
FORMfields v3.0

multiValues

public mixed $multiValues = true

True if this is a multiple value field.

Since:
FORMfields v3.0

otherChoice

public mixed $otherChoice

A sub field for the other choice string.

Since:
FORMfields v3.0

rows

public mixed $rows = null

The number of rows into which to format the checkboxes.

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

CheckboxGroupField

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

Creates a new CheckboxGroupField.

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 checkbox
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

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 v3.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 v3.0

getSingleCheckboxTag

public the getSingleCheckboxTag(CheckboxField checkbox)

Returns the HTML to display a single checkbox.

Parameters:
checkbox - a checkbox to display
Returns:
HTML to display a single checkbox
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 v3.0

setDbValue

public void setDbValue(string value)

Sets the database value of this field. A database value can be different than the field's actual value. For example a phone number may have the value "973-746-3233" but its database value would be "9737463233"

Parameters:
value - a comma separated list of values that is comma escaped
Since:
FORMfields v3.0

setValue

public void setValue(array values, mixed value)

Sets the value of this field.

Parameters:
values - an array of strings equal to the selected options
Since:
FORMfields v3.0

FORMfields