Class FormField
Represents a field in a form.
A FieldSet contains a number of FormField objects which make up the whole of
a form. In addition to single fields, FormField objects can be "composite", for
example, the TabSet field. Composite fields let us define complex forms
without having to resort to custom HTML.
Subclassing
Define a FormField::dataValue() method that returns a value suitable for
inserting into a single database field. For example, you might tidy up the
format of a date or currency field. Define FormField::saveInto() to totally
customise saving. For example, data might be saved to the filesystem instead of
the data record, or saved to a component of the data record instead of the data
record itself.
- Object
-
ViewableData
implements
IteratorAggregate
-
RequestHandler
-
FormField
Direct known subclasses
BouncedList,
CheckboxField,
HiddenField,
InlineFormAction,
InlineFormAction_ReadOnly,
MoneyField,
NewsletterList,
NullableField,
PasswordField,
PermissionCheckboxSetField,
PhoneNumberField,
ProgressBar,
CompositeField,
RangeField,
ReadonlyField,
RecipientExportField,
RecipientImportField,
SimpleImageField_Disabled,
SpamProtectorField,
SubmittedFormReportField,
TableListField,
TextareaField,
TextField,
ConfirmedPasswordField,
ThumbnailStripField,
TreeDropdownField,
TreeSelectorField,
UnsubscribedList,
WidgetAreaEditor,
DatalessField,
DatetimeField,
DropdownField,
FieldEditor,
FileField,
FormAction
Indirect known subclasses
AjaxUniqueTextField,
AssetManager,
ComplexTableField,
ToggleField,
TreeDropdownField_Readonly,
TreeMultiselectField,
TreeMultiselectField_Readonly,
UniqueRestrictedTextField,
UniqueTextField,
VideoManager,
Widget_TreeDropdownField,
CountryDropdownField,
CreditCardField,
CurrencyField,
CurrencyField_Disabled,
CurrencyField_Readonly,
DataObjectManager,
DateField,
DateField_Disabled,
DatePickerField,
AssetTableField,
DatetimeField_Readonly,
DocumentPageFiles_Manager,
EmailField,
FieldGroup,
FileComplexTableField,
FileDataObjectManager,
FileIFrameField,
FileList,
Folder_UnusedAssetsField,
FormAction_WithoutLabel,
AutoCompleteField,
GroupedDropdownField,
HasManyComplexTableField,
HasManyDataObjectManager,
HasManyFileDataObjectManager,
HasOneComplexTableField,
HasOneDataObjectManager,
HasOneFileDataObjectManager,
HeaderField,
HTMLDropdownField,
HtmlEditorField,
AutocompleteTextField,
HtmlEditorField_Readonly,
ImageAssetManager,
ImageDataObjectManager,
ImageField,
ImageFormAction,
LabelField,
LanguageDropdownField,
ListboxField,
LiteralField,
LookupField,
CartTableListField,
ManyManyComplexTableField,
ManyManyDataObjectManager,
ManyManyFileDataObjectManager,
Mediaweb3DPageFiles_Manager,
MediawebPageFiles_Manager,
MediawebPagePhoto_Manager,
MediawebPageTexture_Manager,
MemberTableField,
Monument_PolishingTextField,
MultiUploadField,
CheckboxField_Disabled,
MyRangeField,
NumericField,
OptionsetField,
OrderItemField,
PermissionCheckboxSetField_Readonly,
PhoneField,
PhotoAlbumManager,
PhpCaptchaField,
PrintableTransformation_TabSet,
ProductParamValue_BoolValueField,
CheckboxField_Readonly,
ProductParamValue_MultiValueField,
ProductParamValue_MultiValueSetField,
ProductParamValue_ValueField,
ResetFormAction,
RestrictedTextField,
RestrictionRegionCountryDropdownField,
RoomRate_PriceField,
RoomServiceDropdownField,
SelectionGroup,
SimpleHTMLEditorField,
CheckboxSetField,
SimpleImageField,
SimpleTinyMCEField,
SimpleTreeDropdownField,
SimpleWysiwygField,
SocleSize_SocleSectionTextField,
StateDropdownField,
StateProvinceDropdownField,
StealthFieldCaptcha,
SubpageListField,
SubsiteAgnosticTableListField,
CommentTableField,
SubsiteDropdownField,
SubsitesTreeDropdownField,
Tab,
TableField,
TabSet,
TextFieldWithEmptyFlag,
TextLiteralField,
TimeField,
TimeField_Readonly,
ToggleCompositeField
Methods summary
public static
|
|
public static
|
|
public
|
|
public
|
|
public
|
#
__construct(
Create a new field. |
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
string
|
|
public
|
|
public
string
|
#
Message( )
Returns the field message, used by form validation. Use |
public
string
|
#
MessageType( )
Returns the field message type, used by form validation. Arbitrary value
which is mostly used for CSS classes in the rendered HTML, e.g. "required". Use
|
public
|
|
public
|
#
saveInto(
Method to save this form field into the given data object. By default, makes use of $this->dataValue() |
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
integer
|
|
protected
string
|
|
public
String
|
#
extraClass( )
Compiles all CSS-classes. Optionally includes a "nolabel"-class if no title
was set on the formfield. Uses |
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
boolean
|
|
public
|
|
public
|
#
setCustomValidationMessage( String $msg )
Set the custom error message to show instead of the default format of Please Fill In XXX. Different from setError() as that appends it to the standard error messaging |
public
String
|
#
getCustomValidationMessage( )
Get the custom error message for this form field. If a custom message has not
been defined then just return blank. The default error is defined on |
public
|
#
Field( )
Returns the form field - used by templates. Although FieldHolder is generally what is inserted into templates, all of the field holder templates make use of $Field. It's expected that FieldHolder will give you the "complete" representation of the field on the form, whereas Field will give you the core editing widget, such as an input tag. |
public
|
#
FieldHolder( )
Returns a "Field Holder" for this field - used by templates. Forms are constructed from by concatenating a number of these field holders. The default field holder is a label and form field inside a paragraph tag. |
public
|
|
public
mixed
|
|
public
mixed
|
#
setFieldHolderTemplate( string $fieldHolderTemplate )
Set name of template (without path or extension) for the holder, which in
turn is responsible for rendering |
public
mixed
|
#
setSmallFieldHolderTemplate( string $smallFieldHolderTemplate )
Set name of template (without path or extension) for the small holder, which
in turn is responsible for rendering |
public
array
|
|
public
array
|
#
fieldHolderTemplates( )
Returns an array of templates to use for rendering |
public
array
|
#
smallFieldHolderTemplates( )
Returns an array of templates to use for rendering |
public
|
#
isComposite( )
Returns true if this field is a composite field. To create composite field
types, you should subclass |
public
|
#
hasData( )
Returns true if this field has its own data. Some fields, such as titles and composite fields, don't actually have any data. It doesn't make sense for data-focused methods to look at them. By overloading hasData() to return false, you can prevent any data-focused methods from looking at it. |
public
boolean
|
|
public
|
#
setReadonly( mixed $bool )
Sets readonly-flag on form-field. Please use performReadonlyTransformation() to actually transform this instance. |
public
boolean
|
|
public
|
#
setDisabled( mixed $bool )
Sets disabed-flag on form-field. Please use performDisabledTransformation() to actually transform this instance. |
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
#
jsValidation( )
javascript handler Functions for each field type by default formfield doesnt have a validation function |
public
|
|
public
|
|
public
|
|
public
|
#
forTemplate( )
This function is used by the template processor. If you refer to a field as a $ variable, it will return the $Field value. |
public
boolean
|
|
public
string
|
#
name_to_label( string $fieldName )
Takes a fieldname and converts camelcase to spaced words. Also resolves combined fieldnames with dot syntax to spaced words. |
public
|
|
public
|
Methods inherited from RequestHandler
allowedActions(),
checkAccessAction(),
getRequest(),
handleRequest(),
hasAction(),
httpError()
Methods inherited from ViewableData
ATT_val(),
BaseHref(),
CSSClasses(),
ColumnBreak(),
ColumnCalc(),
ColumnNumber(),
ColumnPad(),
ColumnPos(),
CurrentMember(),
CurrentPage(),
Debug(),
Even(),
EvenOdd(),
First(),
FirstLast(),
HasPerm(),
IsAjax(),
JS_val(),
Last(),
Me(),
Middle(),
MiddleString(),
Modulus(),
MultipleOf(),
Odd(),
Pos(),
RAW_val(),
SQL_val(),
ThemeDir(),
ThemeName(),
Top(),
TotalItems(),
XML_val(),
__get(),
__isset(),
__set(),
buildCastingCache(),
cachedCall(),
castingClass(),
castingHelper(),
castingHelperPair(),
castingObjectCreator(),
castingObjectCreatorPair(),
customise(),
defineMethods(),
escapeTypeForField(),
getField(),
getIterator(),
getSecurityID(),
getXMLValues(),
hasField(),
hasValue(),
i18nLocale(),
iteratorProperties(),
obj(),
renderWith(),
setCustomisedObj(),
setField()
Methods inherited from Object
__call(),
__toString(),
__wakeup(),
addMethodsFrom(),
addStaticVars(),
addWrapperMethod(),
add_extension(),
add_static_var(),
allMethodNames(),
cacheToFile(),
cacheToFileWithArgs(),
clearCache(),
combined_static(),
create(),
createMethod(),
create_from_string(),
exists(),
extInstance(),
extend(),
getCustomClass(),
getExtensionInstance(),
getExtensionInstances(),
get_extensions(),
get_static(),
hasExtension(),
hasMethod(),
has_extension(),
invokeWithExtensions(),
is_a(),
loadCache(),
parentClass(),
parse_class_spec(),
remove_extension(),
sanitiseCachename(),
saveCache(),
set_stat(),
set_static(),
set_uninherited(),
stat(),
strong_create(),
uninherited(),
uninherited_static(),
useCustomClass()
Magic methods summary
Properties summary
protected static
boolean
|
$use_html5 | |
protected
boolean
|
$fieldHTML5 | |
protected
mixed
|
$form | |
protected
mixed
|
$name | |
protected
mixed
|
$title | |
protected
mixed
|
$value | |
protected
mixed
|
$message | |
protected
mixed
|
$messageType | |
protected
mixed
|
$extraClass | |
protected
array
|
$extraAttributes | |
protected
array
|
$html5Attributes | |
protected
boolean
|
$autocomplete | |
protected
mixed
|
$description |
#
string Adds a "title"-attribute to the markup. |
protected
array
|
$extraClasses |
#
array Extra CSS-classes for the formfield-container |
public
mixed
|
$dontEscape | |
protected
string
|
$template |
#
Name of the template used to render this form field. If not set, then will look up the class ancestry for the first matching template where the template name equals the class name. |
protected
string
|
$fieldHolderTemplate |
#
Name of the template used to render this form field. If not set, then will look up the class ancestry for the first matching template where the template name equals the class name. |
protected
string
|
$smallFieldHolderTemplate | |
protected
mixed
|
$rightTitle |
#
string Used in SmallFieldHolder() to force a right-aligned label. |
protected
mixed
|
$leftTitle |
#
string Used in SmallFieldHolder() to force a left-aligned label with correct spacing. Please use $title for FormFields rendered with FieldHolder(). |
protected
integer
|
$tabIndex |
#
Set the "tabindex" HTML attribute on the field. |
protected
|
$containerFieldSet |
#
Stores a reference to the FieldSet that contains this object. |
protected
boolean
|
$readonly |
#
boolean |
protected
boolean
|
$disabled |
#
boolean |
protected
Custom
|
$customValidationMessage |
#
Validation Message for the Field |
public static
array
|
$possible_autocomplete_values |
Properties inherited from RequestHandler
$allowed_actions,
$brokenOnConstruct,
$request,
$url_handlers
Properties inherited from ViewableData
$casting,
$customisedObject,
$default_cast,
$failover,
$iteratorPos,
$iteratorTotalItems