Form
class Form extends Form (View source)
Basic confirmation form implementation.
Renders the list of confirmation items on the screen and reconciles those with the confirmation storage.
If the user confirms the action, marks the storage as confirmed and redirects to the success url (kept in the storage).
If the user declines the action, cleans up the storage and redirects to the failure url (kept in the storage).
Traits
Form component which contains a castable message
Allows an object to have extensions applied to it.
A class that can be instantiated or replaced via DI
Provides extensions to this object to integrate it with standard config API methods.
Allows an object to declare a set of custom methods
Constants
DEFAULT_NAME |
Default form Name property |
ENC_TYPE_URLENCODED |
Form submission data is URL encoded |
ENC_TYPE_MULTIPART |
Form submission data is multipart form |
MERGE_DEFAULT |
|
MERGE_CLEAR_MISSING |
|
MERGE_IGNORE_FALSEISH |
|
MERGE_AS_INTERNAL_VALUE |
|
MERGE_AS_SUBMITTED_VALUE |
|
Properties
static private array | $extensions | An array of extension names and parameters to be applied to this object upon construction. |
from Extensible |
static private array | $casting | from Form | |
static private string | $default_cast | The default object to cast scalar fields to if casting information is not specified, and casting to an object is required. |
from ViewableData |
bool | $IncludeFormTag | Accessed by Form.ss; modified by {@link formHtmlContent()}. |
from Form |
static private array | $default_classes | from Form |
Methods
Attempts to locate and call a method dynamically added to a class at runtime if a default cannot be located
Return the names of all the methods available on this object
Add an extension to a specific class.
No description
Get extra config sources for this class
Return TRUE if a class has a specified extension.
Calls a method if available on both this object and all applied {@link Extensions}, and then attempts to merge all results into an array
Run the given function on all of this object's extensions. Note that this method originally returned void, so if you wanted to return results, you're hosed
Get an extension instance attached to this object by name.
Returns TRUE if this object instance has a specific extension applied in {@link $extension_instances}. Extension instances are initialized at constructor time, meaning if you use {@link add_extension()} afterwards, the added extension will just be added to new instances of the extended class. Use the static method {@link has_extension()} to check if a class (not an instance) has a specific extension.
Get all extension instances for this specific object instance.
An implementation of the factory method, allows you to create an instance of a class
Creates a class instance by the "singleton" design pattern.
Get a configuration accessor for this class. Short hand for Config::inst()->get($this->class, .....).
Gets the uninherited value for the given config option
Check if a field exists on this object or its failover.
Get the value of a property/field on this object. This will check if a method called get{$property} exists, then check if a field is available using {@link ViewableData::getField()}, then fall back on a failover object.
Set a property/field on this object. This will check for the existence of a method called set{$property}, then use the {@link ViewableData::setField()} method.
Set a failover object to attempt to get data from if it is not present on this object.
Check if a field exists on this object. This should be overloaded in child classes.
Get the value of a field on this object. This should be overloaded in child classes.
Set a field on this object. This should be overloaded in child classes.
Add methods from the {@link ViewableData::$failover} object, as well as wrapping any methods prefixed with an underscore into a {@link ViewableData::cachedCall()}.
Merge some arbitrary data in with this object. This method returns a {@link ViewableData_Customised} instance with references to both this and the new custom data.
Return the "casting helper" (a piece of PHP code that when evaluated creates a casted value object) for a field on this object. This helper will be a subclass of DBField.
Get the class name a field on this object will be casted to.
Return the string-format type for the given field.
Render this object into the template, and get the result as a string. You can pass one of the following as the $template parameter:
- a template name (e.g. Page)
- an array of possible template names - the first valid one will be used
- an SSViewer instance
Get the value of a field on this object, automatically inserting the value into any available casting objects that have been specified.
A simple wrapper around {@link ViewableData::obj()} that automatically caches the result so it can be used again without re-running the method.
Checks if a given method/field has a valid value. If the result is an object, this will return the result of the exists method, otherwise will check if the result is not just an empty paragraph tag.
Get the string value of a field on this object that has been suitable escaped to be inserted directly into a template.
Get an array of XML-escaped values by field name
Return a single-item iterator so you can iterate over the fields of a single record.
Find appropriate templates for SSViewer to use to render this object
When rendering some objects it is necessary to iterate over the object being rendered, to do this, you need access to itself.
Get part of the current classes ancestry to be used as a CSS class.
Return debug information about this object that can be rendered into a template
Sets the error message to be displayed on the form field.
Return any ValidationResult instance stored for this object
Sets the ValidationResult in the session to be used with the next view of this form.
Populate this form with messages from the given ValidationResult.
Set message on a given field name. This message will not persist via redirect.
Overrules validation error behaviour in {@link httpSubmission()} when validation has failed. Useful for optional handling of a certain accepted content type.
Set whether the user should be redirected back down to the form on the page upon validation errors in the form or if they just need to redirect back to the page
Get whether the user should be redirected back down to the form on the page upon validation errors
Passed a FormAction, returns true if that action is exempt from Form validation
Generate extra special fields - namely the security token field (if required).
Return all fields in a form - including fields nested in {@link CompositeFields}.
Return the attributes of the form tag - used by the templates.
Set the target of this form to any value - useful for opening the form contents in a new window or refreshing another frame
Return a {@link FormTemplateHelper} for this form. If one has not been set, return the default helper.
Set the target of this form to any value - useful for opening the form contents in a new window or refreshing another frame.
Set the SS template that this form should use to render with. The default is "Form".
Returs the ordered list of preferred templates for rendering this form If the template isn't set, then default to the form class name e.g "Form".
Sets the form encoding type. The most common encoding types are defined in {@link ENC_TYPE_URLENCODED} and {@link ENC_TYPE_MULTIPART}.
Returns the real HTTP method for the form: GET, POST, PUT, DELETE or HEAD.
Set the form method: GET, POST, PUT, DELETE.
If set to true (the default), enforces the matching of the form method.
Returns an object where there is a method with the same name as each data field on the form.
Set a message to the session, for display next time this form is shown.
Set an error to the session, for display next time this form is shown.
Returns the DataObject that has given this form its data through {@link loadDataFrom()}.
Load data from the given DataObject or array.
Save the contents of this form into the given data object.
Get the submitted data from this form through {@link FieldList->dataFields()}, which filters out any form-specific data like form-actions.
Return a rendered version of this form, suitable for ajax post-back.
Render this form using the given template, and return the result as a string You can pass either an SSViewer or a template name
Return the default button that should be clicked when another one isn't available.
Disable the requirement of a security token on this form instance. This security protects against CSRF attacks, but you should disable this if you don't want to tie a form to a session - eg a search form.
Enable {@link SecurityToken} protection for this form instance.
Returns the security token for this form (if any exists).
Add a CSS-class to the form-container. If needed, multiple classes can be added by delimiting a string with spaces.
Remove a CSS-class from the form-container. Multiple class names can be passed through as a space delimited string
The form refusal handler. Cleans up the confirmation storage and returns the failure redirection (kept in the storage)
The form confirmation handler. Checks all the items in the storage has been confirmed and marks them as such. Returns a redirect when all the storage items has been verified and marked as confirmed.
Details
mixed
__call(string $method, array $arguments)
Attempts to locate and call a method dynamically added to a class at runtime if a default cannot be located
You can add extra methods to a class using {@link Extensions}, {@link Object::createMethod()} or {@link Object::addWrapperMethod()}
bool
hasMethod(string $method)
Return TRUE if a method exists on this object
This should be used rather than PHP's inbuild method_exists() as it takes into account methods added via extensions
array
allMethodNames(bool $custom = false)
Return the names of all the methods available on this object
static bool
add_extension(string $classOrExtension, string $extension = null)
Add an extension to a specific class.
The preferred method for adding extensions is through YAML config, since it avoids autoloading the class, and is easier to override in more specific configurations.
As an alternative, extensions can be added to a specific class directly in the {@link Object::$extensions} array. See {@link SiteTree::$extensions} for examples. Keep in mind that the extension will only be applied to new instances, not existing ones (including all instances created through {@link singleton()}).
static
remove_extension(string $extension)
Remove an extension from a class.
Note: This will not remove extensions from parent classes, and must be called directly on the class assigned the extension.
Keep in mind that this won't revert any datamodel additions of the extension at runtime, unless its used before the schema building kicks in (in your _config.php). Doesn't remove the extension from any {@link Object} instances which are already created, but will have an effect on new extensions. Clears any previously created singletons through {@link singleton()} to avoid side-effects from stale extension information.
static array
get_extensions(string $class = null, bool $includeArgumentString = false)
static array|null
get_extra_config_sources(string $class = null)
Get extra config sources for this class
static bool
has_extension(string $classOrExtension, string $requiredExtension = null, bool $strict = false)
Return TRUE if a class has a specified extension.
This supports backwards-compatible format (static Object::has_extension($requiredExtension)) and new format ($object->has_extension($class, $requiredExtension))
array
invokeWithExtensions(string $method, mixed ...$arguments)
Calls a method if available on both this object and all applied {@link Extensions}, and then attempts to merge all results into an array
array
extend(string $method, mixed ...$arguments)
Run the given function on all of this object's extensions. Note that this method originally returned void, so if you wanted to return results, you're hosed
Currently returns an array, with an index resulting every time the function is called. Only adds returns if they're not NULL, to avoid bogus results from methods just defined on the parent extension. This is important for permission-checks through extend, as they use min() to determine if any of the returns is FALSE. As min() doesn't do type checking, an included NULL return would fail the permission checks.
The extension methods are defined during {@link __construct()} in {@link defineMethods()}.
Extension|null
getExtensionInstance(string $extension)
Get an extension instance attached to this object by name.
bool
hasExtension(string $extension)
Returns TRUE if this object instance has a specific extension applied in {@link $extension_instances}. Extension instances are initialized at constructor time, meaning if you use {@link add_extension()} afterwards, the added extension will just be added to new instances of the extended class. Use the static method {@link has_extension()} to check if a class (not an instance) has a specific extension.
Caution: Don't use singleton(
Extension[]
getExtensionInstances()
Get all extension instances for this specific object instance.
See {@link get_extensions()} to get all applied extension classes for this class (not the instance).
This method also provides lazy-population of the extension_instances property.
static Injectable
create(array ...$args)
An implementation of the factory method, allows you to create an instance of a class
This method will defer class substitution to the Injector API, which can be customised via the Config API to declare substitution classes.
This can be called in one of two ways - either calling via the class directly, or calling on Object and passing the class name as the first parameter. The following are equivalent: $list = DataList::create('SiteTree'); $list = SiteTree::get();
static Injectable
singleton(string $class = null)
Creates a class instance by the "singleton" design pattern.
It will always return the same instance for this class, which can be used for performance reasons and as a simple way to access instance methods which don't rely on instance data (e.g. the custom SilverStripe static handling).
static Config_ForClass
config()
Get a configuration accessor for this class. Short hand for Config::inst()->get($this->class, .....).
mixed
stat(string $name)
deprecated
deprecated
Get inherited config value
mixed
uninherited(string $name)
Gets the uninherited value for the given config option
$this
set_stat(string $name, mixed $value)
deprecated
deprecated
Update the config value for a given property
__construct(string $storageId, RequestHandler $controller, string $formConstructor)
bool
__isset(string $property)
Check if a field exists on this object or its failover.
Note that, unlike the core isset() implementation, this will return true if the property is defined and set to null.
mixed
__get(string $property)
Get the value of a property/field on this object. This will check if a method called get{$property} exists, then check if a field is available using {@link ViewableData::getField()}, then fall back on a failover object.
__set(string $property, mixed $value)
Set a property/field on this object. This will check for the existence of a method called set{$property}, then use the {@link ViewableData::setField()} method.
setFailover(ViewableData $failover)
Set a failover object to attempt to get data from if it is not present on this object.
ViewableData|null
getFailover()
Get the current failover object if set
bool
hasField(string $field)
Check if a field exists on this object. This should be overloaded in child classes.
mixed
getField(string $field)
Get the value of a field on this object. This should be overloaded in child classes.
$this
setField(string $field, mixed $value)
Set a field on this object. This should be overloaded in child classes.
defineMethods()
Add methods from the {@link ViewableData::$failover} object, as well as wrapping any methods prefixed with an underscore into a {@link ViewableData::cachedCall()}.
ViewableData_Customised
customise(array|ViewableData $data)
Merge some arbitrary data in with this object. This method returns a {@link ViewableData_Customised} instance with references to both this and the new custom data.
Note that any fields you specify will take precedence over the fields on this object.
bool
exists()
Return true if this object "exists" i.e. has a sensible value
This method should be overriden in subclasses to provide more context about the classes state. For example, a {@link DataObject} class could return false when it is deleted from the database
string
__toString()
ViewableData
getCustomisedObj()
setCustomisedObj(ViewableData $object)
in
Form at line 524
string
castingHelper(string $field)
Return the "casting helper" (a piece of PHP code that when evaluated creates a casted value object) for a field on this object. This helper will be a subclass of DBField.
string
castingClass(string $field)
Get the class name a field on this object will be casted to.
string
escapeTypeForField(string $field)
Return the string-format type for the given field.
DBHTMLText
renderWith(string|array|SSViewer $template, array $customFields = null)
Render this object into the template, and get the result as a string. You can pass one of the following as the $template parameter:
- a template name (e.g. Page)
- an array of possible template names - the first valid one will be used
- an SSViewer instance
object|DBField
obj(string $fieldName, array $arguments = [], bool $cache = false, string $cacheName = null)
Get the value of a field on this object, automatically inserting the value into any available casting objects that have been specified.
object|DBField
cachedCall(string $field, array $arguments = [], string $identifier = null)
A simple wrapper around {@link ViewableData::obj()} that automatically caches the result so it can be used again without re-running the method.
bool
hasValue(string $field, array $arguments = [], bool $cache = true)
Checks if a given method/field has a valid value. If the result is an object, this will return the result of the exists method, otherwise will check if the result is not just an empty paragraph tag.
string
XML_val(string $field, array $arguments = [], bool $cache = false)
Get the string value of a field on this object that has been suitable escaped to be inserted directly into a template.
array
getXMLValues(array $fields)
Get an array of XML-escaped values by field name
ArrayIterator
getIterator()
Return a single-item iterator so you can iterate over the fields of a single record.
This is useful so you can use a single record inside a <% control %> block in a template - and then use to access individual fields on this object.
array
getViewerTemplates(string $suffix = '')
Find appropriate templates for SSViewer to use to render this object
ViewableData
Me()
When rendering some objects it is necessary to iterate over the object being rendered, to do this, you need access to itself.
string
ThemeDir()
deprecated
deprecated
Return the directory if the current active theme (relative to the site root).
This method is useful for things such as accessing theme images from your template without hardcoding the theme page - e.g. .
This method should only be used when a theme is currently active. However, it will fall over to the current project directory.
string
CSSClasses(string $stopAtClass = self::class)
Get part of the current classes ancestry to be used as a CSS class.
This method returns an escaped string of CSS classes representing the current classes ancestry until it hits a stop point - e.g. "Page DataObject ViewableData".
ViewableData_Debugger
Debug()
Return debug information about this object that can be rendered into a template
string
getMessage()
Returns the field message, used by form validation.
Use {@link setError()} to set this property.
string
getMessageType()
Returns the field message type.
Arbitrary value which is mostly used for CSS classes in the rendered HTML, e.g "required".
Use {@link setError()} to set this property.
string
getMessageCast()
Casting type for this message. Will be 'text' or 'html'
$this
setMessage(string $message, string $messageType = ValidationResult::TYPE_ERROR, string $messageCast = ValidationResult::CAST_TEXT)
Sets the error message to be displayed on the form field.
Allows HTML content, so remember to use Convert::raw2xml().
array|null
getSchemaMessage()
Get form schema encoded message
in
Form at line 323
bool
getNotifyUnsavedChanges()
in
Form at line 331
setNotifyUnsavedChanges($flag)
in
Form at line 341
$this
restoreFormState()
Load form state from session state
in
Form at line 362
$this
clearFormState()
Flush persistant form state details
in
Form at line 409
array
getSessionData()
Return any form data stored in the session
in
Form at line 420
$this
setSessionData(array $data)
Store the given form data in the session
in
Form at line 431
ValidationResult
getSessionValidationResult()
Return any ValidationResult instance stored for this object
in
Form at line 446
$this
setSessionValidationResult(ValidationResult $result, bool $combineWithExisting = false)
Sets the ValidationResult in the session to be used with the next view of this form.
in
Form at line 471
$this
clearMessage()
Clear form message (and in session)
in
Form at line 485
$this
loadMessagesFrom(ValidationResult $result)
Populate this form with messages from the given ValidationResult.
Note: This will not clear any pre-existing messages
in
Form at line 511
$this
setFieldMessage(string $fieldName, string $message, string $messageType = ValidationResult::TYPE_ERROR, string $messageCast = ValidationResult::CAST_TEXT)
Set message on a given field name. This message will not persist via redirect.
in
Form at line 550
callable
getValidationResponseCallback()
in
Form at line 565
Form
setValidationResponseCallback($callback)
Overrules validation error behaviour in {@link httpSubmission()} when validation has failed. Useful for optional handling of a certain accepted content type.
The callback can opt out of handling specific responses by returning NULL, in which case the default form behaviour will kick in.
in
Form at line 577
$this
makeReadonly()
Convert this form into a readonly form
in
Form at line 591
$this
setRedirectToFormOnValidationError(bool $bool)
Set whether the user should be redirected back down to the form on the page upon validation errors in the form or if they just need to redirect back to the page
in
Form at line 603
bool
getRedirectToFormOnValidationError()
Get whether the user should be redirected back down to the form on the page upon validation errors
in
Form at line 611
transform(FormTransformation $trans)
in
Form at line 636
Validator
getValidator()
Get the {@link Validator} attached to this form.
in
Form at line 646
$this
setValidator(Validator $validator)
Set the {@link Validator} on this form.
in
Form at line 658
unsetValidator()
Remove the {@link Validator} from this from.
in
Form at line 670
$this
setValidationExemptActions($actions)
Set actions that are exempt from validation
in
Form at line 681
array
getValidationExemptActions()
Get a list of actions that are exempt from validation
in
Form at line 692
bool
actionIsValidationExempt(FormAction $action)
Passed a FormAction, returns true if that action is exempt from Form validation
in
Form at line 712
FieldList
getExtraFields()
Generate extra special fields - namely the security token field (if required).
in
Form at line 740
FieldList
Fields()
Return the form's fields - used by the templates
in
Form at line 758
FieldList
HiddenFields()
Return all fields in a form - including fields nested in {@link CompositeFields}.
Useful when doing custom field layouts.
in
Form at line 767
VisibleFields()
Return all fields except for the hidden fields.
Useful when making your own simplified form layouts.
in
Form at line 778
$this
setFields(FieldList $fields)
Setter for the form fields.
in
Form at line 791
FieldList
Actions()
Return the form's action buttons - used by the templates
in
Form at line 802
$this
setActions(FieldList $actions)
Setter for the form actions.
in
Form at line 813
unsetAllActions()
Unset all form actions
in
Form at line 824
$this
setAttribute(string $name, string $value)
in
Form at line 834
string
getAttribute(string $name)
in
Form at line 845
array
getAttributes()
in
Form at line 876
string
getAttributesHTML(array $attrs = null)
Return the attributes of the form tag - used by the templates.
in
Form at line 910
FormAttributes()
in
Form at line 921
setTemplateHelper($helper)
Set the target of this form to any value - useful for opening the form contents in a new window or refreshing another frame
in
Form at line 932
FormTemplateHelper
getTemplateHelper()
Return a {@link FormTemplateHelper} for this form. If one has not been set, return the default helper.
in
Form at line 952
$this
setTarget(string $target)
Set the target of this form to any value - useful for opening the form contents in a new window or refreshing another frame.
in
Form at line 965
$this
setLegend(string $legend)
Set the legend value to be inserted into the
in
Form at line 978
$this
setTemplate(string|array $template)
Set the SS template that this form should use to render with. The default is "Form".
in
Form at line 989
string|array
getTemplate()
Return the template to render this form with.
in
Form at line 1001
array
getTemplates()
Returs the ordered list of preferred templates for rendering this form If the template isn't set, then default to the form class name e.g "Form".
in
Form at line 1018
getEncType()
Returns the encoding type for the form.
By default this will be URL encoded, unless there is a file field present in which case multipart is used. You can also set the enc type using {@link setEncType}.
in
Form at line 1042
$this
setEncType(string $encType)
Sets the form encoding type. The most common encoding types are defined in {@link ENC_TYPE_URLENCODED} and {@link ENC_TYPE_MULTIPART}.
in
Form at line 1060
string
FormHttpMethod()
Returns the real HTTP method for the form: GET, POST, PUT, DELETE or HEAD.
As most browsers only support GET and POST in form submissions, all other HTTP methods are added as a hidden field "_method" that gets evaluated in {@link HTTPRequest::detect_method()}. See {@link FormMethod()} to get a HTTP method for safe insertion into a
in
Form at line 1071
string
FormMethod()
Returns the form method to be used in the
in
Form at line 1087
$this
setFormMethod(string $method, bool $strict = null)
Set the form method: GET, POST, PUT, DELETE.
in
Form at line 1109
$this
setStrictFormMethodCheck($bool)
If set to true (the default), enforces the matching of the form method.
This will mean two things:
- GET vars will be ignored by a POST form, and vice versa
- A submission where the HTTP method used doesn't match the form will return a 400 error.
If set to false then the form method is only used to construct the default form.
in
Form at line 1118
bool
getStrictFormMethodCheck()
in
Form at line 1129
string
FormAction()
Return the form's action attribute.
This is build by adding an executeForm get variable to the parent controller's Link() value
in
Form at line 1149
$this
setFormAction(string $path)
Set the form action attribute to a custom URL.
Note: For "normal" forms, you shouldn't need to use this method. It is recommended only for situations where you have two relatively distinct parts of the system trying to communicate via a form post.
in
Form at line 1161
string
FormName()
Returns the name of the form.
in
Form at line 1172
$this
setHTMLID(string $id)
Set the HTML ID attribute of the form.
in
Form at line 1182
string
getHTMLID()
in
Form at line 1192
RequestHandler
getController()
Get the controller or parent request handler.
in
Form at line 1203
$this
setController(RequestHandler $controller = null)
Set the controller or parent request handler.
in
Form at line 1214
string
getName()
Get the name of the form.
in
Form at line 1225
Form
setName(string $name)
Set the name of the form.
in
Form at line 1240
FieldMap()
Returns an object where there is a method with the same name as each data field on the form.
That method will return the field itself.
It means that you can execute $firstName = $form->FieldMap()->FirstName()
in
Form at line 1253
sessionMessage(string $message, string $type = ValidationResult::TYPE_ERROR, string|bool $cast = ValidationResult::CAST_TEXT)
Set a message to the session, for display next time this form is shown.
in
Form at line 1269
sessionError(string $message, string $type = ValidationResult::TYPE_ERROR, string|bool $cast = ValidationResult::CAST_TEXT)
Set an error to the session, for display next time this form is shown.
in
Form at line 1283
DataObject
getRecord()
Returns the DataObject that has given this form its data through {@link loadDataFrom()}.
in
Form at line 1294
string
getLegend()
Get the legend value to be inserted into the
in
Form at line 1316
ValidationResult
validationResult()
Processing that occurs before a form is executed.
This includes form validation, if it fails, we throw a ValidationException
This includes form validation, if it fails, we redirect back to the form with appropriate error messages. Always return true if the current form action is exempt from validation
Triggered through {@link httpSubmission()}.
Note that CSRF protection takes place in {@link httpSubmission()}, if it fails the form data will never reach this method.
in
Form at line 1390
$this
loadDataFrom(array|DataObject $data, int $mergeStrategy = 0, array $fieldList = null)
Load data from the given DataObject or array.
It will call $object->MyField to get the value of MyField. If you passed an array, it will call $object[MyField]. Doesn't save into dataless FormFields ({@link DatalessField}), as determined by {@link FieldList->dataFields()}.
By default, if a field isn't set (as determined by isset()), its value will not be saved to the field, retaining potential existing values.
Passed data should not be escaped, and is saved to the FormField instances unescaped. Escaping happens automatically on saving the data through {@link saveInto()}.
Escaping happens automatically on saving the data through {@link saveInto()}.
in
Form at line 1519
saveInto(DataObjectInterface $dataObject, FieldList $fieldList = null)
Save the contents of this form into the given data object.
It will make use of setCastedField() to do this.
in
Form at line 1555
array
getData()
Get the submitted data from this form through {@link FieldList->dataFields()}, which filters out any form-specific data like form-actions.
Calls {@link FormField->dataValue()} on each field, which returns a value suitable for insertion into a DataObject property.
in
Form at line 1580
DBHTMLText
forTemplate()
Return a rendered version of this form.
This is returned when you access a form as $FormObject rather than <% with FormObject %>
in
Form at line 1602
DBHTMLText
forAjaxTemplate()
Return a rendered version of this form, suitable for ajax post-back.
It triggers slightly different behaviour, such as disabling the rewriting of # links.
in
Form at line 1624
string
formHtmlContent()
deprecated
deprecated
Returns an HTML rendition of this form, without the
in
Form at line 1646
DBHTMLText
renderWithoutActionButton(string|array $template)
Render this form using the given template, and return the result as a string You can pass either an SSViewer or a template name
in
Form at line 1665
FormAction
defaultAction()
Return the default button that should be clicked when another one isn't available.
in
Form at line 1682
Form
disableDefaultAction()
Disable the default button.
Ordinarily, when a form is processed and no action_XXX button is available, then the first button in the actions list will be pressed. However, if this is "delete", for example, this isn't such a good idea.
in
Form at line 1699
Form
disableSecurityToken()
Disable the requirement of a security token on this form instance. This security protects against CSRF attacks, but you should disable this if you don't want to tie a form to a session - eg a search form.
Check for token state with {@link getSecurityToken()} and {@link SecurityToken->isEnabled()}.
in
Form at line 1714
Form
enableSecurityToken()
Enable {@link SecurityToken} protection for this form instance.
Check for token state with {@link getSecurityToken()} and {@link SecurityToken->isEnabled()}.
in
Form at line 1730
SecurityToken|null
getSecurityToken()
Returns the security token for this form (if any exists).
Doesn't check for {@link securityTokenEnabled()}.
Use {@link SecurityToken::inst()} to get a global token.
in
Form at line 1740
string
extraClass()
Compiles all CSS-classes.
in
Form at line 1753
$this
addExtraClass(string $class)
Add a CSS-class to the form-container. If needed, multiple classes can be added by delimiting a string with spaces.
in
Form at line 1771
$this
removeExtraClass(string $class)
Remove a CSS-class from the form-container. Multiple class names can be passed through as a space delimited string
in
Form at line 1782
debug()
in
Form at line 1812
RequestHandler
getRequestHandler()
Get request handler for this form
in
Form at line 1826
$this
setRequestHandler(FormRequestHandler $handler)
Assign a specific request handler for this form
HTTPResponse
doRefuse()
The form refusal handler. Cleans up the confirmation storage and returns the failure redirection (kept in the storage)
HTTPResponse
doConfirm()
The form confirmation handler. Checks all the items in the storage has been confirmed and marks them as such. Returns a redirect when all the storage items has been verified and marked as confirmed.