FORMfields


FORMfields.fields.SetSelectorField

Class SetSelectorField

FormField
|
+--DropDownField
|
+--ListField
|
+--MultipleListField
|
+--SetSelectorField

public class SetSelectorField
extends MultipleListField

SetSelectorField is a field for selecting a list of choices.

Since:
FORMfields v1.0

Field Summary
mixed

$add

The sub field for the add button.

mixed

$addOther

The sub field for the add button.

mixed

$defaultOptions

A string array of default options used in the superset list.

mixed

$includeOtherChoice

True if other options can be added to the subset list.

mixed

$otherChoice

The sub field used for editing the other choice.

mixed

$remove

The sub field for the remove button

mixed

$setChanged

True if the sub list selection has changed since the last form data post.

mixed

$subset

The sub field for the subset list.

mixed

$superset

The sub field for the superset list.

Fields inherited from FORMfields.fields.MultipleListField
maxSelections, minSelections, multiValues
Constructor Summary

SetSelectorField(string name, string supersetLabel, string subsetLabel, array options, int height, mixed height2, int required, int maxSelections, int minSelections, boolean includeOtherChoice)

Creates a new SetSelectorField.

__construct(string name, string supersetLabel, string subsetLabel, array options, int height, mixed height2, int required, int maxSelections, int minSelections, boolean includeOtherChoice)

Creates a new SetSelectorField.

Method Summary
void

adjustSuperset()

Adjust the values in the options and values arrays according to the selected values.

void

clearValue()

Sets this field's value to null.

string

getALabelTag(FormField formField)

A static method that returns the HTML to display a form field label.

string

getEditableFieldTag()

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

void

getParameter()

Retrieves the posted field value.

void

setDbValue(string value)

Sets the database value of this field.

void

setValue(array value)

Sets the value of this field.

Methods inherited from FORMfields.fields.MultipleListField
getEditableFieldTag, isValid

Field Detail

add

public mixed $add = null

The sub field for the add button.

Since:
FORMfields v1.0

addOther

public mixed $addOther = null

The sub field for the add button.

Since:
FORMfields v3.0

defaultOptions

public mixed $defaultOptions = null

A string array of default options used in the superset list.

Since:
FORMfields v3.0

includeOtherChoice

public mixed $includeOtherChoice = false

True if other options can be added to the subset list.

Since:
FORMfields v3.0

otherChoice

public mixed $otherChoice = null

The sub field used for editing the other choice.

Since:
FORMfields v3.0

remove

public mixed $remove = null

The sub field for the remove button

Since:
FORMfields v1.0

setChanged

public mixed $setChanged = false

True if the sub list selection has changed since the last form data post.

Since:
FORMfields v1.0

subset

public mixed $subset = null

The sub field for the subset list.

Since:
FORMfields v1.0

superset

public mixed $superset = null

The sub field for the superset list.

Since:
FORMfields v1.0

Constructor Detail

SetSelectorField

public SetSelectorField(string name, string supersetLabel, string subsetLabel, array options, int height, mixed height2, int required, int maxSelections, int minSelections, boolean includeOtherChoice)

Creates a new SetSelectorField. Note: The selectedOptions parameter was removed in v3.0. The default values should be set outside of this class. Remove height2 in next release.

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.
supersetLabel - the superset label
subsetLabel - the subset label and also this field's label
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
height - the height or number of rows to display in both the superset and subset lists
maxSelections - The maximum number of slections that can be made
minSelections - The minimum number of slections that can be made if any selections were made
includeOtherChoice - true if the user should be able to add another option to the subset list that is not in the superset list
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

adjustSuperset

public void adjustSuperset()

Adjust the values in the options and values arrays according to the selected values.

Since:
FORMfields v1.0

clearValue

public void clearValue()

Sets this field's value to null. This includes setting the values of any sub fields.

Since:
FORMfields v1.0

getALabelTag

public string getALabelTag(FormField formField)

A static method that returns the HTML to display a form field label.

Parameters:
formField - a FormField
Returns:
the HTML to display a form field label
Since:
FORMfields v1.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

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

setValue

public void setValue(array value)

Sets the value of this field.

Parameters:
value - a string array of options that are selected
Since:
FORMfields v1.0

FORMfields