Version: current

# Class EditableFormField

Represents the base class of a editable form field object like `EditableTextField`.

  Object
  ViewableData implements IteratorAggregate
  DataObject implements DataObjectInterface, i18nEntityProvider
  EditableFormField

### Direct known subclasses

`EditableCheckbox`, `EditableCountryDropdownField`, `EditableMultipleOptionField`, `EditableNumericField`, `EditablePhoneField`, `EditableSiteAgreementField`, `EditableSpamProtectionField`, `EditableTextField`, `EditableTimeField`, `EditableDateField`, `EditableDateTimeField`, `EditableEmailField`, `EditableFileField`, `EditableFormHeading`, `EditableHiddenField`, `EditableLiteralField`, `EditableMemberListField`

### Indirect known subclasses

`EditableCheckboxGroupField`, `EditableDropdown`, `EditableRadioField`

Package: userforms
Located at userforms/code/model/formfields/EditableFormField.php

## Methods summary

`public static <type>` | # `get_possible_autocompletes( mixed $empty = false )` Список возможных autocomplete Список возможных autocomplete #### Returns `<type>` <type>
`public` | # `setReadonly( boolean $readonly = true )` Set the visibility of an individual form field Set the visibility of an individual form field #### Parameters $readonly bool
`public boolean` | # `isReadonly( )` Returns whether this field is readonly Returns whether this field is readonly #### Returns `boolean` bool
`public String` | # `EditSegment( )` Template to render the form field into Template to render the form field into #### Returns `String` String
`public boolean` | # `canCreate( `Member` $member = null )` #### Parameters $member Member $member #### Returns `boolean` boolean #### Overrides `DataObject::canCreate`
`public boolean` | # `canDelete( `Member` $member = null )` Return whether a user can delete this form field based on whether they can edit the page Return whether a user can delete this form field based on whether they can edit the page #### Parameters $member Member $member #### Returns `boolean` bool #### Overrides `DataObject::canDelete`
`public boolean` | # `canEdit( `Member` $member = null )` Return whether a user can edit this form field based on whether they can edit the page Return whether a user can edit this form field based on whether they can edit the page #### Parameters $member Member $member #### Returns `boolean` bool #### Overrides `DataObject::canEdit`
`public` | # `doPublish( mixed $fromStage = "Stage", mixed $toStage = "Live", mixed $createNewVersion = false )` Publish this Form Field to the live site Publish this Form Field to the live site Wrapper for the `Versioned` publish function
`public` | # `doDeleteFromStage( mixed $stage )` Delete this form from a given stage Delete this form from a given stage Wrapper for the `Versioned` deleteFromStage function
`public boolean` | # `getShowOnLoad( )` Show this form on load or not Show this form on load or not #### Returns `boolean` bool
`public Array` | # `getSettings( )` To prevent having tables for each fields minor settings we store it as a serialized array in the database. To prevent having tables for each fields minor settings we store it as a serialized array in the database. #### Returns `Array` Return all the Settings
`public` | # `setSettings( Array $settings = array() )` Set the custom settings for this field as we store the minor details in a serialized array in the database Set the custom settings for this field as we store the minor details in a serialized array in the database #### Parameters $settings Array the custom settings
`public` | # `setSetting( String $key, String $value )` Set a given field setting. Appends the option to the settings or overrides the existing value Set a given field setting. Appends the option to the settings or overrides the existing value #### Parameters $key String key $value String value
`public` | # `setAllowedCss( array $allowed )` Set the allowed css classes for the extraClass custom setting Set the allowed css classes for the extraClass custom setting #### Parameters $allowed array The permissible CSS classes to add
`public String` | # `getSetting( String $setting )` Return just one custom setting or empty string if it does not exist Return just one custom setting or empty string if it does not exist #### Parameters $setting String Value to use as key #### Returns `String` String
`public string` | # `getIcon( )` Get the path to the icon for this field type, relative to the site root. Get the path to the icon for this field type, relative to the site root. #### Returns `string` string
`public boolean` | # `getHasAddableOptions( )` Return whether or not this field has addable options such as a dropdown field or radio set Return whether or not this field has addable options such as a dropdown field or radio set #### Returns `boolean` bool
`public boolean` | # `showExtraOptions( )` Return whether or not this field needs to show the extra options dropdown list Return whether or not this field needs to show the extra options dropdown list #### Returns `boolean` bool
`public array` | # `Dependencies( )` Return the custom validation fields for this field for the CMS Return the custom validation fields for this field for the CMS #### Returns `array` array
`public `DataObjectSet`` | # `CustomRules( )` Return the custom validation fields for the field Return the custom validation fields for the field #### Returns ``DataObjectSet`` DataObjectSet
`public `TextField`` | # `TitleField( )` Title field of the field in the backend of the page Title field of the field in the backend of the page #### Returns ``TextField`` TextField
`public string` | # `getTitle( )` Returns the Title for rendering in the front-end (with XML values escaped) Returns the Title for rendering in the front-end (with XML values escaped) #### Returns `string` string #### Overrides `DataObject::getTitle`
`public String` | # `getFieldName( String $field = false )` Return the base name for this form field in the form builder. Optionally returns the name with the given field Return the base name for this form field in the form builder. Optionally returns the name with the given field #### Parameters $field String Field Name #### Returns `String` String
`public String` | # `getSettingName( String $field )` Generate a name for the Setting field Generate a name for the Setting field #### Parameters $field String name of the setting #### Returns `String` String
`public` | # `populateFromPostData( mixed $data )` How to save the data submitted in this field into the database object which this field represents. How to save the data submitted in this field into the database object which this field represents. Any class's which call this should also call parent::populateFromPostData() to ensure that this method is called
`public `FieldSet`` | # `getFieldConfiguration( )` Implement custom field Configuration on this field. Includes such things as settings and options of a given editable form field Implement custom field Configuration on this field. Includes such things as settings and options of a given editable form field #### Returns ``FieldSet`` FieldSet
`public `FieldSet`` | # `getFieldValidationOptions( )` Append custom validation fields to the default 'Validation' section in the editable options view Append custom validation fields to the default 'Validation' section in the editable options view #### Returns ``FieldSet`` FieldSet
`public `FormField`` | # `getFormField( )` Return a FormField to appear on the front end. Implement on your subclass Return a FormField to appear on the front end. Implement on your subclass #### Returns ``FormField`` FormField
`public `SubmittedFormField`` | # `getSubmittedFormField( )` Return the instance of the submission field class Return the instance of the submission field class #### Returns ``SubmittedFormField`` SubmittedFormField
`public boolean` | # `showInReports( )` Show this form field (and its related value) in the reports and in emails. Show this form field (and its related value) in the reports and in emails. #### Returns `boolean` bool
`public Array` | # `getValidation( )` Return the validation information related to this field. This is interrupted as a JSON object for validate plugin and used in the PHP. Return the validation information related to this field. This is interrupted as a JSON object for validate plugin and used in the PHP. #### Returns `Array` Array #### See http://docs.jquery.com/Plugins/Validation/Methods
`public `Varchar`` | # `getErrorMessage( )` Return the error message for this field. Either uses the custom one (if provided) or the default SilverStripe message Return the error message for this field. Either uses the custom one (if provided) or the default SilverStripe message #### Returns ``Varchar`` Varchar

### Methods inherited from DataObject

`Aggregate()`, `RelationshipAggregate()`, `__construct()`, `baseTable()`, `belongs_to()`, `buildDataObjectSet()`, `buildSQL()`, `can()`, `canView()`, `castedUpdate()`, `composite_fields()`, `context_obj()`, `customDatabaseFields()`, `custom_database_fields()`, `data()`, `databaseFields()`, `databaseIndexes()`, `database_extensions()`, `database_fields()`, `db()`, `dbObject()`, `debug()`, `defaultSearchFilters()`, `defineMethods()`, `delete()`, `delete_by_id()`, `destroy()`, `disableCMSFieldsExtensions()`, `disable_subclass_access()`, `duplicate()`, `enableCMSFieldsExtensions()`, `enable_subclass_access()`, `exists()`, `extendedSQL()`, `fieldLabel()`, `fieldLabels()`, `flushCache()`, `flush_and_destroy_cache()`, `forceChange()`, `get()`, `getAllFields()`, `getCMSActions()`, `getCMSFields()`, `getChangedFields()`, `getClassAncestry()`, `getComponent()`, `getComponents()`, `getComponentsQuery()`, `getDefaultSearchContext()`, `getField()`, `getFrontEndFields()`, `getManyManyComponents()`, `getManyManyComponentsQuery()`, `getManyManyFilter()`, `getManyManyJoin()`, `getRemoteJoinField()`, `getReverseAssociation()`, `get_by_id()`, `get_one()`, `get_validation_enabled()`, `hasDatabaseField()`, `hasField()`, `hasOwnTableDatabaseField()`, `hasValue()`, `has_many()`, `has_one()`, `has_own_table()`, `i18n_plural_name()`, `i18n_singular_name()`, `inheritedDatabaseFields()`, `instance_get()`, `instance_get_one()`, `isChanged()`, `isEmpty()`, `isInDB()`, `is_composite_field()`, `many_many()`, `many_many_extraFields()`, `merge()`, `newClassInstance()`, `onAfterDelete()`, `onAfterWrite()`, `onBeforeDelete()`, `onBeforeWrite()`, `plural_name()`, `populateDefaults()`, `provideI18nEntities()`, `relObject()`, `requireDefaultRecords()`, `requireTable()`, `reset()`, `scaffoldFormFields()`, `scaffoldSearchFields()`, `searchableFields()`, `setCastedField()`, `setClassName()`, `setComponent()`, `setField()`, `set_context_obj()`, `set_validation_enabled()`, `singular_name()`, `summaryFields()`, `toMap()`, `update()`, `validate()`, `write()`, `writeComponents()`, `writeWithoutVersion()`

### 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()`, `escapeTypeForField()`, `getIterator()`, `getSecurityID()`, `getXMLValues()`, `i18nLocale()`, `iteratorProperties()`, `obj()`, `renderWith()`, `setCustomisedObj()`

### 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()`, `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

`public static string` | $default_sort | # The default sort expression. This will be inserted in the ORDER BY clause of a SQL query if no other sort expression is provided. The default sort expression. This will be inserted in the ORDER BY clause of a SQL query if no other sort expression is provided.
`public static array` | $allowed_css | # A list of CSS classes that can be added A list of CSS classes that can be added
`public static array` | $db | # Database field definitions. This is a map from field names to field type. The field type should be a class that extends . Database field definitions. This is a map from field names to field type. The field type should be a class that extends .
`public static array` | $has_one | # One-to-zero relationship defintion. This is a map of component name to data type. In order to turn this into a true one-to-one relationship you can add a `DataObject::$belongs_to` relationship on the child class. One-to-zero relationship defintion. This is a map of component name to data type. In order to turn this into a true one-to-one relationship you can add a `DataObject::$belongs_to` relationship on the child class. Note that you cannot have a has_one and belongs_to relationship with the same name.
`public static array` | $extensions | # An array of extension names and parameters to be applied to this object upon construction. An array of extension names and parameters to be applied to this object upon construction. Example:
    public static $extensions = array (
      'Hierachy',
      "Version('Stage', 'Live')"
    );
Use `Object::add_extension()` to add extensions without access to the class code, e.g. to extend core classes. Extensions are instanciated together with the object and stored in `Object::$extension_instances`.
`protected boolean` | $readonly | #

### Properties inherited from DataObject

`$allowed_actions`, `$ancestry`, `$api_access`, `$belongs_many_many`, `$belongs_to`, `$brokenOnDelete`, `$brokenOnWrite`, `$cache_get_one`, `$cache_has_own_table`, `$cache_has_own_table_field`, `$casting`, `$componentCache`, `$components`, `$create_table_options`, `$default_records`, `$defaults`, `$destroyed`, `$field_labels`, `$has_many`, `$indexes`, `$many_many`, `$many_many_extraFields`, `$original`, `$plural_name`, `$record`, `$searchable_fields`, `$singular_name`, `$summary_fields`

### Properties inherited from ViewableData

`$customisedObject`, `$default_cast`, `$failover`, `$iteratorPos`, `$iteratorTotalItems`

### Properties inherited from Object

`$class`, `$extension_instances`

[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -