Overview

Form-processing class; also hints the view on how to present the form.

Package

This class is part of the Solar_Form package.

Inheritance:

Configuration Keys

  • request: A Solar_Request dependency object.

  • filter: A Solar_Filter dependency injection; default is empty, which creates a standard Solar_Filter object on the fly.

  • success: The overall "success" message when validating form input. Default is Solar locale key SUCCESS_FORM.

  • failure: The overall "failure" message when validating form input. Default is Solar locale key FAILURE_FORM.

  • attribs: An array of <form> tag attributes; used for hinting the view on how to present the form. Defaults are 'method="post"', 'action="REQUEST_URI"', and 'enctype="multipart/form-data"'.

Constants

Public Properties

These are all the public properties in the Solar_Form class.

You can also view the list of all public, protected, and private properties.

$attribs

Attributes for the form tag itself.

$elements

The array of elements in this form.

$feedback

Overall feedback about the state of the form.

Public Methods

These are all the public methods in the Solar_Form class.

You can also view the list of all public, protected, and private methods.

__construct()

Constructor.

__destruct()

Default destructor; does nothing other than provide a safe fallback for calls to parent::__destruct().

addFilter()

Adds one filter to an element.

addFilters()

Adds many filters to one element.

addInvalid()

Adds one or more invalid message to an element, sets the element status to false (invalid), and sets the form status to false (invalid); if the element does not exist, adds the message as form-level feedback.

addInvalids()

Adds invalidation messages to multiple elements, sets their status to false (invalid) and sets the form status to false (invalid).

dump()

Convenience method for getting a dump the whole object, or one of its properties, or an external variable.

getElements()

Gets multiple elements from this form.

getStatus()

Gets the current overall form validation status.

getValue()

Returns one form element value.

getValues()

Returns the form element values as an array.

isFailure()

Has the current form failed validation?

isSuccess()

Has the current form been successfully validated?

load()

Loads form attributes and elements from an external source.

locale()

Looks up class-specific locale strings based on a key.

orderElements()

Reorders the existing elements.

populate()

Automatically populates form elements with specified values.

reset()

Resets the form object to its originally-configured state, and adds an anti-CSRF element with the current value of the session token.

setAttribs()

Sets the attributes of one element.

setElement()

Sets one element in the form.

setElements()

Sets multiple elements in the form.

setFilterLocaleObject()

Tells the internal filter what object it should use for locale translations.

setStatus()

Forcibly sets the overall form validation status.

setType()

Sets the type of one element.

setValue()

Manually set the value of one element.

setValues()

Manually set the value of several elements.

validate()

Applies the filter chain to the form element values; in particular, checks validation and updates the 'invalid' keys for each element that fails, and checks for CSRF attempts automatically.



Local