FORMfields


FORMfields.fields.FormField

Class FormField

FormField

public class FormField

FormField is the base class of a form field.

Since:
FORMfields v1.0

Field Summary
mixed

$autoPropagate

True if values of not editable or not enabled fields should be propagated using a hidden field.

mixed

$data

True if this field should be considered data and the field value should be read from a database and written to a database.

mixed

$disableEnterHandler

If the enterTabs is true, the HTML included in the input tag to disable when the user presses enter while editing a field.

mixed

$displayValuesOnNewLine

True if multiple values should be separated by new lines.

mixed

$editable

True if this field is editible.

mixed

$enabled

True if the field is enabled.

mixed

$endingString

The string displayed directly after the field label.

mixed

$enterTabHandler

If the enterTabs is true, the HTML included in the input tag to process a tab.

mixed

$enterTabs

True if we should force a tab when enter is pressed when editing this field.

mixed

$error

The error string associated with this field upon a failed validation.

mixed

$extraHtml

Any extra HTML/JavaScript code that should be inserted into the input tag.

mixed

$fieldBelowLabel

True if the field should be displayed below the label instead of inline with the label.

mixed

$formError

An error string set by this field that is not particular to this field and will be propagated up to FfForm.

mixed

$help

The HTML help string that appears to the right of a field.

mixed

$hidden

True if this field is a hidden field.

mixed

$htmlify

True if FORMfields should try to automatically HTMLify the HTML display value of this field.

mixed

$id

The value of the id attribute printed in this field's input tag.

mixed

$isData

True if this field should be considered data and the field value should be read from a database and written to a database.

mixed

$label

This form field's label.

mixed

$labelForId

The value of the for attribute in the input tag.

mixed

$multiValues

True if this is a multiple value field.

mixed

$name

The name of the form field.

mixed

$required

Whether the field must be filled in and whether it looks like it must be filled in.

mixed

$subFieldDisplayValueSeparator

A string separator used to separate the display values of the sub fields.

mixed

$subFieldSeparator

A string separator used to separate the sub fields when they are being edited.

mixed

$subFieldValueSeparator

A string separator used to separate the values of the sub fields.

mixed

$subFields

An array of sub fields, if any, for this field.

mixed

$subFieldsCannotBeEmpty

True if an empty sub field constitutes an invalid value.

mixed

$trimWhitespace

True if whitespace should automatically be trimmed from user entered values.

mixed

$validators

Callback classes that are used to implement form validation.

mixed

$value

The value of this form field.

mixed

$valueIsHtml

True if FORMfields should not apply htmlspecialchars() or try to automatically HTMLify the HTML display value of this field.

Constructor Summary

FormField(string name, string label, int required)

FormField constructor.

__construct(string name, string label, int required)

FormField constructor.

Method Summary
void

addFieldValidator(mixed fieldValidator)

Add a field validator, a callback class that is used to implement form validation.

void

addSubField(FormField field)

Append a sub field to the end of the subFields array.

boolean

checkForBlank()

Returns true if this field's value is blank and if it is, also sets the field error.

void

clearValue()

Sets this field's value to null.

void

disable()

Disables the field.

returns

formatRequestParameter(mixed value)

A static method that returns a formatted $_REQUEST value.

string

formatText(mixed text)

A static method that returns text wrapped in FORMfields span tags.

boolean

getButtonClicked()

Returns true if a submit button from this field was clicked.

boolean

getData()

Returns whether this field should be considered data and if this field's value should be read from a database and written to a database.

string

getDbValue()

Returns the database value of this field.

string

getDisableFieldJs()

Returns JavaScript code to disable the input field portion of this field during run-time.

string

getDisableJs()

Returns JavaScript code to disable this field during run-time.

string

getDisableLabelJs()

Returns JavaScript code to disable the label portion of this field during run-time.

string

getDisplayFieldTag(boolean displayHelp)

Returns the HTML used to display this field's value and not within an input field.

string

getDisplayHtmlValue()

Returns the HTML value of this field.

string

getDisplayLabelTag(string cssPostfix, boolean wrap)

Returns the HTML used to display this field's display label.

string

getDisplayValue()

Returns the display value of this field.

boolean

getEditable()

Returns whether this field is editable.

string

getEditableFieldTag()

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

string

getEditableLabelTag(string cssPostfix, boolean wrap)

Returns the HTML used to display this field's editiable label.

boolean

getEnabled()

Returns whether the field is enabled.

string

getError()

Returns the error string associated with this field upong a failed validation.

string

getExtraHtml()

Returns any extra HTML/JavaScript code that should be inserted into the input tag.

string

getFieldTag()

Returns the HTML to display this field.

string

getFormError()

Returns the the error string set by this field that is not particular to this field and will be propagated up to the FfForm.

string

getHelp()

Returns the HTML help string that appears to the right of a field.

string

getHelpTag()

Returns the HTML used to display this field's help text.

boolean

getHidden()

Returns whether this field is a hidden field.

string

getHiddenFieldTag()

Returns the HTML that describes this field as a hidden field.

string

getId()

Returns the value of the id attribute printed in this field's input tag.

boolean

getIsData()

Returns whether this field should be considered data and if this field's value should be read from a database and written to a database.

boolean

getIsHidden()

Returns whether this field is a hidden field.

string

getLabel()

Returns this form field's label.

string

getLabelHtml(boolean wrap)

Returns the HTML used to display the label.

string

getLabelTag(string cssPostfix, boolean wrap)

Returns the HTML used to display this field's label based on the field's editable state.

string

getName()

Returns the name of the form field.

mixed

getOrNull(string index, array anArray)

A static method that returns the value in the array at the specified index or null, if the value doesn't exist.

void

getParameter()

Retrieves the posted field value.

string

getRawDbValue()

Returns the raw database value of this field.

int

getRequired()

Returns whether the field must be filled in and whether it looks like it must be filled in.

mixed

getValue()

Returns the value of this form field.

boolean

isBlank(string value)

A static method that returns true if value is blank such as the value of a field when the user hasn't filled in that field.

boolean

isEmpty()

Returns true if the field value is blank such as when the user hasn't filled in the value.

boolean

isValid()

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

void

setAutoPropagate(boolean autoPropagate)

Sets whether values of not editable or not enabled fields should be propagated using a hidden field.

void

setData(mixed data, boolean true)

Sets whether this field should be considered data and if this field's value should be read from a database and written to a database.

void

setDbValue(string value)

Sets the database value of this field.

void

setDisplayValuesOnNewLine(boolean displayValuesOnNewLine)

Sets whether multiple values should be separated by new lines.

void

setEditable(boolean editable)

Sets whether this field is editable.

void

setEnabled(boolean enabled)

Sets whether the field is enabled.

void

setEndingString(string endingString)

Sets the string displayed directly after the field label.

void

setError(string error)

Sets the error string associated with this field upon a failed validation.

void

setExtraHtml(string extraHtml)

Sets any extra HTML/JavaScript code that should be inserted into the input tag.

void

setFieldBelowLabel(boolean fieldBelowLabel)

Sets where the field should be displayed below the label instead of inline with the label.

void

setFormError(string error)

Sets the the error string set by this field that is not particular to this field and will be propagated up to the FfForm.

void

setHelp(string help)

Sets the HTML help string that appears to the right of a field.

void

setHidden(boolean hidden)

Sets whether this field is a hidden field.

void

setHtmlify(boolean htmlify)

Sets whether FORMfields should try to automatically HTMLify the HTML display value of this field.

void

setId(string id)

Sets the value of the id attribute printed in this field's input tag.

void

setIsData(mixed data, boolean true)

Sets whether this field should be considered data and if this field's value should be read from a database and written to a database.

void

setIsHidden(boolean hidden)

Sets whether this field is a hidden field.

void

setLabel(string label)

Sets the label of this form field.

void

setName(string name)

Sets the name of the form field.

void

setRequired(int required)

Sets whether the field must be filled in and whether it looks like it must be filled in.

void

setTrimWhitespace(boolean trimWhitespace)

Sets whether whitespace should automatically be trimmed from user entered values.

void

setValue(mixed value)

Sets the value of this form field.

void

setValueIsHtml(boolean valueIsHtml)

Sets whether if FORMfields should not apply htmlspecialchars() or try to automatically HTMLify the HTML display value of this field.

boolean

validate()

Performs field value validation using any form validators and checks for errors.

Field Detail

autoPropagate

public mixed $autoPropagate = true

True if values of not editable or not enabled fields should be propagated using a hidden field. This feature provides great convienence, but can be insecure as the user can insert values into these hidden fields. This however, is not usually a problem as typically users only have access to modify their own data and have no interest in corrupting their own data.

Since:
FORMfields v2.0

data

public mixed $data = true

True if this field should be considered data and the field value should be read from a database and written to a database.

Since:
FORMfields v1.0

disableEnterHandler

public mixed $disableEnterHandler = " onkeypress=\"return disableEnter(event);\" "

If the enterTabs is true, the HTML included in the input tag to disable when the user presses enter while editing a field.

Since:
FORMfields v1.0

displayValuesOnNewLine

public mixed $displayValuesOnNewLine = true

True if multiple values should be separated by new lines. This value is ignored if this field is a single value field.

Since:
FORMfields v3.0

editable

public mixed $editable = true

True if this field is editible. A field that is not editable shows the field value as a string and not as a typical input field.

Since:
FORMfields v1.0

enabled

public mixed $enabled = true

True if the field is enabled. A disabled field shows as a typcial input field, but is grayed out and cannot be modified.

Since:
FORMfields v1.0

endingString

public mixed $endingString = FORM_FIELD_DEFAULT_ENDING_STRING

The string displayed directly after the field label. This value is defaulted to ":".

Since:
FORMfields v3.0

enterTabHandler

public mixed $enterTabHandler = " onkeypress=\"return enterTabHandler(this, event);\" "

If the enterTabs is true, the HTML included in the input tag to process a tab.

Since:
FORMfields v1.0

enterTabs

public mixed $enterTabs = false

True if we should force a tab when enter is pressed when editing this field. Unfortunately, the way web browsers respond when "enter" is pressed while in a text field is not standard. Therefore, it is sometimes diserable standardize and force a tab when "enter" is pressed.

Since:
FORMfields v1.0

error

public mixed $error = null

The error string associated with this field upon a failed validation.

Since:
FORMfields v1.0

extraHtml

public mixed $extraHtml = null

Any extra HTML/JavaScript code that should be inserted into the input tag. For example, "onclick="alert('clicked')"".

Since:
FORMfields v1.0

fieldBelowLabel

public mixed $fieldBelowLabel = false

True if the field should be displayed below the label instead of inline with the label.

Since:
FORMfields v3.0

formError

public mixed $formError = null

An error string set by this field that is not particular to this field and will be propagated up to FfForm.

Since:
FORMfields v3.0

help

public mixed $help = null

The HTML help string that appears to the right of a field. See HTML Special Characters

Since:
FORMfields v1.0

hidden

public mixed $hidden = false

True if this field is a hidden field.

Since:
FORMfields v1.0

htmlify

public mixed $htmlify = true

True if FORMfields should try to automatically HTMLify the HTML display value of this field. In doing so, URL's and email addresses are converted to hyperlinks.

Since:
FORMfields v3.0

id

public mixed $id = null

The value of the id attribute printed in this field's input tag. The id value is defaulted to the field's name. Note: The id can be used to reference this field in JavaScript.

Since:
FORMfields v2.0

isData

public mixed $isData = true

True if this field should be considered data and the field value should be read from a database and written to a database.

Deprecated:
use data instead. Will be removed in the next release of FORMfields.

label

public mixed $label = null

This form field's label. The label is the printable text that is typically displayed on the left side of the field.

Since:
FORMfields v1.0

labelForId

public mixed $labelForId = null

The value of the for attribute in the input tag. This value associates a label with a field so that in say the case of a radio button, the user can click the radio button label and cause a click on the appropriate radio button box.

Since:
FORMfields v3.0

multiValues

public mixed $multiValues = false

True if this is a multiple value field. Most of the time this value remains a constant per field type.

Since:
FORMfields v3.0

name

public mixed $name = null

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.

Since:
FORMfields v1.0

required

public mixed $required = FORM_FIELD_REQUIRED

Whether the field must be filled in and whether it looks like it must be filled in.

See Also:
FORM_FIELD_REQUIRED
FORM_FIELD_NOT_REQUIRED
FORM_FIELD_LOOKS_REQUIRED
FORM_FIELD_REQUIRED_NO_LOOK
Since:
FORMfields v1.0

Constructor Detail

FormField

public FormField(string name, string label, int required)

FormField constructor.

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

addFieldValidator

public void addFieldValidator(mixed fieldValidator)

Add a field validator, a callback class that is used to implement form validation.

See Also:
FORMfields.fields.FfFieldValidator
Since:
FORMfields v3.0

addSubField

public void addSubField(FormField field)

Append a sub field to the end of the subFields array.

Parameters:
field - the sub field
Since:
FORMfields v3.0

checkForBlank

public boolean checkForBlank()

Returns true if this field's value is blank and if it is, also sets the field error.

Returns:
true if the value is blank or false if the value is not blank
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

disable

public void disable()

Disables the field. A disabled field shows as a typcial input field, but is grayed out and cannot be modified.

Since:
FORMfields v2.0
Deprecated:
use setEnabled() instead. Will be removed in next release of FORMfields.

formatRequestParameter

public returns formatRequestParameter(mixed value)

A static method that returns a formatted $_REQUEST value. This is needed as values are encoded during form submission.

Parameters:
value - the $_REQUEST value
Returns:
the formatted value
Since:
FORMfields v2.0

formatText

public string formatText(mixed text)

A static method that returns text wrapped in FORMfields span tags. This method is used to format text used when displaying input fields.

Returns:
text wrapped in FORMfields span tags
Since:
FORMfields v2.0

getButtonClicked

public boolean getButtonClicked()

Returns true if a submit button from this field was clicked. This method is used to control how a form is processed. Note: submit button clicks like refreshes from a SetSelectorField are considered button clicks by this method.

Returns:
true if a submit button from this field was clicked
Since:
FORMfields v3.0

getData

public boolean getData()

Returns whether this field should be considered data and if this field's value should be read from a database and written to a database.

Returns:
true if data, false if not data
Since:
FORMfields v3.0

getDbValue

public string getDbValue()

Returns 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'". Note: wrapping single quotes are automatically added to a database value for easy use in an SQL query. Furthermore, if the field value is null then the database value will be "null" and not "'null'".

Returns:
the database value of the field wrapped in single quotes or "null"
Since:
FORMfields v1.0

getDisableFieldJs

public string getDisableFieldJs()

Returns JavaScript code to disable the input field portion of this field during run-time.

Returns:
JavaScript code to disable the input field portion of this field during run-time
Since:
FORMfields v1.0

getDisableJs

public string getDisableJs()

Returns JavaScript code to disable this field during run-time.

Returns:
JavaScript code to disable this field during run-time
Since:
FORMfields v1.0

getDisableLabelJs

public string getDisableLabelJs()

Returns JavaScript code to disable the label portion of this field during run-time.

Returns:
JavaScript code to disable the label portion of this field during run-time
Since:
FORMfields v1.0

getDisplayFieldTag

public string getDisplayFieldTag(boolean displayHelp)

Returns the HTML used to display this field's value and not within an input field.

Parameters:
displayHelp - true if the field help should be displayed
Returns:
the HTML used to display this field's value
Since:
FORMfields v1.0

getDisplayHtmlValue

public string getDisplayHtmlValue()

Returns the HTML value of this field. For example, the value could be "www.formfields.com" and the HTML display value could be "My Website".

Returns:
the HTML value of this field.
Since:
FORMfields v3.0

getDisplayLabelTag

public string getDisplayLabelTag(string cssPostfix, boolean wrap)

Returns the HTML used to display this field's display label.

Parameters:
cssPostfix - a string that will be appended to the CSS class names used in this tag to make these class names unique, or null
wrap - true or null if the label text should be wrapped
Returns:
the HTML used to display this field's display label.
Since:
FORMfields v2.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

getEditable

public boolean getEditable()

Returns whether this field is editable. A field that is not editable shows the field value as a string and not as a typical input field.

Returns:
editable true if editable, false if not editable
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

getEditableLabelTag

public string getEditableLabelTag(string cssPostfix, boolean wrap)

Returns the HTML used to display this field's editiable label.

Parameters:
cssPostfix - a string that will be appended to the CSS class names used in this tag to make these class names unique, or null
wrap - true or null if the label text should be wrapped
Returns:
the HTML used to display this field's editible label.
Since:
FORMfields v3.0

getEnabled

public boolean getEnabled()

Returns whether the field is enabled. A disabled field shows as a typcial input field, but is grayed out and cannot be modified.

Returns:
true if enabled, false if disabled
Since:
FORMfields v2.0

getError

public string getError()

Returns the error string associated with this field upong a failed validation.

Returns:
the error string associated with this field
Since:
FORMfields v1.0

getExtraHtml

public string getExtraHtml()

Returns any extra HTML/JavaScript code that should be inserted into the input tag. For example, "onclick="alert('clicked')"".

Returns:
any extra HTML/JavaScrip code that should be inserted into the input tag, or null
Since:
FORMfields v1.0

getFieldTag

public string getFieldTag()

Returns the HTML to display this field.

Returns:
the HTML to display this field
Since:
FORMfields v1.0

getFormError

public string getFormError()

Returns the the error string set by this field that is not particular to this field and will be propagated up to the FfForm.

Returns:
the error string not particular to this field, or null
Since:
FORMfields v3.0

getHelp

public string getHelp()

Returns the HTML help string that appears to the right of a field. See HTML Special Characters

Returns:
the HTML help string for this field
Since:
FORMfields v1.0

getHelpTag

public string getHelpTag()

Returns the HTML used to display this field's help text.

Returns:
the HTML used to display this field's help text.
Since:
FORMfields v2.0

getHidden

public boolean getHidden()

Returns whether this field is a hidden field.

Returns:
true if this is field hidden, false if this field is not hidden
Since:
FORMfields v3.0

getHiddenFieldTag

public string getHiddenFieldTag()

Returns the HTML that describes this field as a hidden field.

Returns:
the HTML that describes this field as a hidden field
Since:
FORMfields v2.0

getId

public string getId()

Returns the value of the id attribute printed in this field's input tag. The id value is defaulted to the field's name. Note: The id can be used to reference this field in JavaScript.

Returns:
the value of the id attribute printed in this field's input tag
Since:
FORMfields v2.0

getIsData

public boolean getIsData()

Returns whether this field should be considered data and if this field's value should be read from a database and written to a database.

Returns:
true if data, false if not data
Since:
FORMfields v1.0
Deprecated:
use getData() instead. Will be removed in the next release of FORMfields.

getIsHidden

public boolean getIsHidden()

Returns whether this field is a hidden field.

Returns:
true if this is field hidden, false if this field is not hidden
Since:
FORMfields v1.0
Deprecated:
use getHidden() instead. Will be removed in next release of FORMfields.

getLabel

public string getLabel()

Returns this form field's label. The label is the printable text that is typically displayed on the left side of the field.

Returns:
this form field's label.
Since:
FORMfields v1.0

getLabelHtml

public string getLabelHtml(boolean wrap)

Returns the HTML used to display the label. Note: we wrap the label based on character length to standardize the label width as each browser implements the max length of a CSS element in different ways.

Parameters:
wrap - true or null if the label text should be wrapped
Returns:
the HTML use to display the label
Since:
FORMfields v3.0

getLabelTag

public string getLabelTag(string cssPostfix, boolean wrap)

Returns the HTML used to display this field's label based on the field's editable state.

Parameters:
cssPostfix - a string that will be appended to the CSS class names used in this tag to make these class names unique, or null
wrap - true or null if the label text should be wrapped
Returns:
the HTML used to display this field's label
Since:
FORMfields v1.0

getName

public string getName()

Returns 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.

Returns:
the name of this field
Since:
FORMfields v1.0

getOrNull

public mixed getOrNull(string index, array anArray)

A static method that returns the value in the array at the specified index or null, if the value doesn't exist.

Parameters:
index - an array index or key
anArray - an array
Returns:
the array value or null if array value doesn't exist
Since:
FORMfields v1.0

getParameter

public void getParameter()

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

Since:
FORMfields v1.0

getRawDbValue

public string getRawDbValue()

Returns the raw 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 raw database value would be "9737463233".

Returns:
the database value of the field
Since:
FORMfields v1.0

getRequired

public int getRequired()

Returns whether the field must be filled in and whether it looks like it must be filled in.

Returns:
Returns whether the field must be filled in and whether it looks like it must be filled in.
Since:
FORMfields v1.0

getValue

public mixed getValue()

Returns the value of this form field.

Returns:
the value of this form field.
Since:
FORMfields v1.0

isBlank

public boolean isBlank(string value)

A static method that returns true if value is blank such as the value of a field when the user hasn't filled in that field.

Parameters:
value - a value to test for being blank
Returns:
true if the value is blank
Since:
FORMfields v1.0

isEmpty

public boolean isEmpty()

Returns true if the field value is blank such as when the user hasn't filled in the value.

Returns:
true if the field value is blank
Since:
FORMfields v3.0

isValid

public boolean isValid()

Checks for field errors detected by this field, including a check for blank. 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

setAutoPropagate

public void setAutoPropagate(boolean autoPropagate)

Sets whether values of not editable or not enabled fields should be propagated using a hidden field. This feature provides great convienence, but can be insecure as the user can insert values into these hidden fields. This however, is not usually a problem as typically users only have access to modify their own data and have no interest in corrupting their own data.

Parameters:
autoPropagate - true if should auto propagate
Since:
FORMfields v2.0

setData

public void setData(mixed data, boolean true)

Sets whether this field should be considered data and if this field's value should be read from a database and written to a database.

Parameters:
true - if data, false if not data
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 - the new database value of the field
Since:
FORMfields v1.0

setDisplayValuesOnNewLine

public void setDisplayValuesOnNewLine(boolean displayValuesOnNewLine)

Sets whether multiple values should be separated by new lines. This value is ignored if this field is a single value field.

Parameters:
displayValuesOnNewLine - true if multiple values should be separated by new lines
Since:
FORMfields v3.0

setEditable

public void setEditable(boolean editable)

Sets whether this field is editable. A field that is not editable shows the field value as a string and not as a typical input field.

Parameters:
editable - true to make editable, false to make not editable
Since:
FORMfields v1.0

setEnabled

public void setEnabled(boolean enabled)

Sets whether the field is enabled. A disabled field shows as a typcial input field, but is grayed out and cannot be modified.

Parameters:
enabled - true to enable, false to disable
Since:
FORMfields v2.0

setEndingString

public void setEndingString(string endingString)

Sets the string displayed directly after the field label. This value is defaulted to ":".

Parameters:
endingString - the string to display directly after the field label
Since:
FORMfields v3.0

setError

public void setError(string error)

Sets the error string associated with this field upon a failed validation.

Parameters:
error - an error string
Since:
FORMfields v1.0

setExtraHtml

public void setExtraHtml(string extraHtml)

Sets any extra HTML/JavaScript code that should be inserted into the input tag. For example, "onclick="alert('clicked')"".

Parameters:
extraHtml - any extra HTML/JavaScrip code that should be inserted into the input tag
Since:
FORMfields v1.0

setFieldBelowLabel

public void setFieldBelowLabel(boolean fieldBelowLabel)

Sets where the field should be displayed below the label instead of inline with the label.

Parameters:
fieldBelowLabel - true if the field should be below the label
Since:
FORMfields v3.0

setFormError

public void setFormError(string error)

Sets the the error string set by this field that is not particular to this field and will be propagated up to the FfForm.

Parameters:
error - an error string not particular to this field
Since:
FORMfields v3.0

setHelp

public void setHelp(string help)

Sets the HTML help string that appears to the right of a field. See HTML Special Characters

Parameters:
help - an HTML help string
Since:
FORMfields v1.0

setHidden

public void setHidden(boolean hidden)

Sets whether this field is a hidden field.

Parameters:
hidden - true to make this field hidden, false to not make this field hidden
Since:
FORMfields v3.0

setHtmlify

public void setHtmlify(boolean htmlify)

Sets whether FORMfields should try to automatically HTMLify the HTML display value of this field. In doing so, URL's and email addresses are converted to hyperlinks. This value is true by default.

Parameters:
htmlify - true if FORMfields should try to automatically HTMLify the HTML display of of this field.
Since:
FORMfields v3.0

setId

public void setId(string id)

Sets the value of the id attribute printed in this field's input tag. The id value is defaulted to the field's name. Note: The id can be used to reference this field in JavaScript.

Parameters:
id - the value of the id attribute printed in this field's input tag
Since:
FORMfields v2.0

setIsData

public void setIsData(mixed data, boolean true)

Sets whether this field should be considered data and if this field's value should be read from a database and written to a database.

Parameters:
true - if data, false if not data
Since:
FORMfields v1.0
Deprecated:
use setData() instead. Will be removed in the next release of FORMfields.

setIsHidden

public void setIsHidden(boolean hidden)

Sets whether this field is a hidden field.

Parameters:
hidden - true to make this field hidden, false to not make this field hidden
Since:
FORMfields v1.0
Deprecated:
use setHidden() instead. Will be removed in next release of FORMfields.

setLabel

public void setLabel(string label)

Sets the label of this form field. The label is the printable text that is typically displayed on the left side of the field.

Parameters:
label - a label for this form field
Since:
FORMfields v1.0

setName

public void setName(string name)

Sets 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.

Parameters:
name - a name for this form field
Since:
FORMfields v1.0

setRequired

public void setRequired(int required)

Sets whether the field must be filled in and whether it looks like it must be filled in.

Parameters:
required - FORM_FIELD_REQUIRED, FORM_FIELD_NOT_REQUIRED, FORM_FIELD_LOOKS_REQUIRED or FORM_FIELD_REQUIRED_NO_LOOK
See Also:
FORM_FIELD_REQUIRED
FORM_FIELD_NOT_REQUIRED
FORM_FIELD_LOOKS_REQUIRED
FORM_FIELD_REQUIRED_NO_LOOK
Since:
FORMfields v1.0

FORMfields