Version: current

# Class FileDataObjectManager_Popup

Base class for all forms. The form class is an extensible base for all forms on a sapphire application. It can be used either by extending it, and creating processor methods on the subclass, or by creating instances of form whose actions are handled by the parent controller.

In either case, if you want to get a form to do anything, it must be inextricably tied to a controller. The constructor is passed a controller and a method on that controller. This method should return the form object, and it shouldn't require any arguments. Parameters, if necessary, can be passed using the URL or get variables. These restrictions are in place so that we can recreate the form object upon form submission, without the use of a session, which would be too resource-intensive.

You will need to create at least one method for processing the submission (through `FormAction`). This method will be passed two parameters: the raw request data, and the form object. Usually you want to save data into a `DataObject` by using `Form::saveInto()`. If you want to process the submitted data in any way, please use `Form::getData()` rather than the raw request data.

## Validation

Each form needs some form of `Validator` to trigger the FormField->validate() methods for each field. You can't disable validator for security reasons, because crucial behaviour like extension checks for file uploads depend on it. The default validator is an instance of `RequiredFields`. If you want to enforce serverside-validation to be ignored for a specific `FormField`, you need to subclass it.

## URL Handling

The form class extends `RequestHandler`, which means it can be accessed directly through a URL. This can be handy for refreshing a form by ajax, or even just displaying a single form field. You can find out the base URL for your form by looking at the <form action="..."> value. For example, the edit form in the CMS would be located at "admin/EditForm". This URL will render the form without its surrounding template when called through GET instead of POST.

By appending to this URL, you can render invidual form elements through the FormField->FieldHolder() method. For example, the "URLSegment" field in a standard CMS form would be accessible through "admin/EditForm/field/URLSegment/FieldHolder".

  Object
  ViewableData implements IteratorAggregate
  RequestHandler
  Form
  DataObjectManager_Popup
  FileDataObjectManager_Popup

### Direct known subclasses

`ImageDataObjectManager_Popup`, `MediawebPage_Popup`, `PhotoAlbumManager_Popup`

Package: forms\core
Located at dataobject_manager/code/FileDataObjectManager.php

## Methods summary

`public` | # `__construct( `Controller` $controller, String $name, `FieldSet` $fields, `FieldSet` $validator, `Validator` $readonly, mixed $dataObject )` Create a new form, with the given fields an action buttons. Create a new form, with the given fields an action buttons. #### Parameters $controller Controller $controller The parent controller, necessary to create the appropriate form action tag. $name String $name The method on the controller that will return this form object. $fields FieldSet $fields All of the fields in the form - a `FieldSet` of `FormField` objects. $validator FieldSet $actions All of the action buttons in the form - a `FieldSet` of `FormAction` objects $readonly Validator $validator Override the default validator instance (Default: `RequiredFields`) $dataObject #### Overrides `DataObjectManager_Popup::__construct`

### Methods inherited from DataObjectManager_Popup

`FieldHolder()`, `getFileFields()`, `getNestedDOMs()`, `getParentController()`

### Methods inherited from Form

`Actions()`, `Controller()`, `FieldMap()`, `Fields()`, `FormAction()`, `FormAttributes()`, `FormEncType()`, `FormHttpMethod()`, `FormMethod()`, `FormName()`, `HiddenFields()`, `Message()`, `MessageType()`, `Name()`, `addErrorMessage()`, `addExtraClass()`, `buttonClicked()`, `callfieldmethod()`, `clearMessage()`, `current_action()`, `dataFieldByName()`, `debug()`, `defaultAction()`, `disableDefaultAction()`, `disableSecurityToken()`, `disable_all_security_tokens()`, `extraClass()`, `forAjaxTemplate()`, `forTemplate()`, `formHtmlContent()`, `getData()`, `getExtraClasses()`, `getExtraFields()`, `getLegend()`, `getMessageFromSession()`, `getRecord()`, `getRedirectToFormOnValidationError()`, `getTemplate()`, `getValidator()`, `handleField()`, `httpSubmission()`, `loadDataFrom()`, `makeReadonly()`, `messageForForm()`, `removeExtraClass()`, `renderWithoutActionButton()`, `resetField()`, `resetValidation()`, `saveInto()`, `securityTokenEnabled()`, `sessionMessage()`, `setActions()`, `setButtonClicked()`, `setFields()`, `setFormAction()`, `setFormMethod()`, `setHTMLID()`, `setLegend()`, `setMessage()`, `setRedirectToFormOnValidationError()`, `setTarget()`, `setTemplate()`, `setValidator()`, `set_current_action()`, `setupFormErrors()`, `single_field_required()`, `testAjaxSubmission()`, `testSubmission()`, `transform()`, `transformTo()`, `unsetActionByName()`, `unsetAllActions()`, `unsetDataFieldByName()`, `unsetFieldFromTab()`, `unsetValidator()`, `validate()`

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

### Properties inherited from DataObjectManager_Popup

`$NestedController`, `$dataObject`, `$sourceClass`

### Properties inherited from Form

`$IncludeFormTag`, `$actions`, `$buttonClickedFunc`, `$controller`, `$current_action`, `$extraClasses`, `$fields`, `$formMethod`, `$hasDefaultAction`, `$jsValidationIncluded`, `$legend`, `$message`, `$messageType`, `$name`, `$record`, `$redirectToFormOnValidationError`, `$security`, `$target`, `$template`, `$url_handlers`, `$validator`

### Properties inherited from RequestHandler

`$allowed_actions`, `$brokenOnConstruct`, `$request`

### Properties inherited from ViewableData

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

### Properties inherited from Object

`$class`, `$extension_instances`, `$extensions`

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