\JForm
Form Class for the Joomla Platform.
This class implements a robust API for constructing, populating, filtering, and validating forms.
It uses XML definitions to construct form fields and a variety of field and rule classes to
render and validate the form.
Synopsis
class JForm
{
- // members
- protected $data;
- protected $errors;
- protected $name;
- protected $options;
- protected SimpleXMLElement $xml;
- protected $forms;
- public $repeat;
- // methods
- public void __construct()
- public boolean bind()
- protected void bindLevel()
- public mixed filter()
- public array getErrors()
- public mixed getField()
- public mixed getFieldAttribute()
- public array getFieldset()
- public array getFieldsets()
- public string getFormControl()
- public array getGroup()
- public string getInput()
- public string getLabel()
- public string getName()
- public mixed getValue()
- public string getControlGroup()
- public string getControlGroups()
- public boolean load()
- public boolean loadFile()
- public boolean removeField()
- public boolean removeGroup()
- public boolean reset()
- public boolean setField()
- public boolean setFieldAttribute()
- public boolean setFields()
- public boolean setValue()
- public mixed validate()
- protected mixed filterField()
- protected mixed findField()
- protected mixed findFieldsByFieldset()
- protected mixed findFieldsByGroup()
- protected mixed findGroup()
- protected mixed loadField()
- protected mixed loadFieldType()
- protected mixed loadRuleType()
- protected boolean syncPaths()
- protected mixed validateField()
- public static array addFieldPath()
- public static array addFormPath()
- public static array addRulePath()
- public static getInstance()
- protected static void addNode()
- protected static void mergeNode()
- protected static void mergeNodes()
- public mixed getAttribute()
- public JRegistry getData()
- public SimpleXMLElement getXml()
Hierarchy
Extended by
Tasks
Tasks
Line | Task |
---|---|
1836+ | Maybe we should receive all addXXXpaths attributes at once? |
Members
protected
- $data
—
The JRegistry data store for form fields during display. - $errors
—
array
The form object errors array. - $forms
—
array
Form instances. - $name
—
string
The name of the form instance. - $options
—
array
The form object options for use in rendering and validation. - $xml
—
SimpleXMLElement
The form XML definition.
public
- $repeat
—
mixed
Alows extensions to implement repeating elements
Methods
protected
- addNode() — Adds a new child SimpleXMLElement node to the source.
- bindLevel() — Method to bind data to the form for the group level.
- filterField() — Method to apply an input filter to a value based on field data.
- findField() — Method to get a form field represented as an XML element object.
- findFieldsByFieldset() — Method to get an array of <field /> elements from the form XML document which are in a specified fieldset by name.
- findFieldsByGroup() — Method to get an array of <field /> elements from the form XML document which are in a control group by name.
- findGroup() — Method to get a form field group represented as an XML element object.
- loadField() — Method to load, setup and return a JFormField object based on field data.
- loadFieldType() — Proxy for {@link JFormHelper::loadFieldType()}.
- loadRuleType() — Proxy for JFormHelper::loadRuleType().
- mergeNode() — Update the attributes of a child node
- mergeNodes() — Merges new elements into a source <fields> element.
- syncPaths() — Method to synchronize any field, form or rule paths contained in the XML document.
- validateField() — Method to validate a JFormField object based on field data.
public
- __construct() — Method to instantiate the form object.
- addFieldPath() — Proxy for {@link JFormHelper::addFieldPath()}.
- addFormPath() — Proxy for JFormHelper::addFormPath().
- addRulePath() — Proxy for JFormHelper::addRulePath().
- bind() — Method to bind data to the form.
- filter() — Method to filter the form data.
- getAttribute() — Returns the value of an attribute of the form itself
- getControlGroup() — Method to get a control group with label and input.
- getControlGroups() — Method to get all control groups with label and input of a fieldset.
- getData() — Getter for the form data
- getErrors() — Return all errors, if any.
- getField() — Method to get a form field represented as a JFormField object.
- getFieldAttribute() — Method to get an attribute value from a field XML element. If the attribute doesn't exist or is null then the optional default value will be used.
- getFieldset() — Method to get an array of JFormField objects in a given fieldset by name. If no name is given then all fields are returned.
- getFieldsets() — Method to get an array of fieldset objects optionally filtered over a given field group.
- getFormControl() — Method to get the form control. This string serves as a container for all form fields. For example, if there is a field named 'foo' and a field named 'bar' and the form control is empty the fields will be rendered like: <input name="foo" /> and <input name="bar" />. If the form control is set to 'joomla' however, the fields would be rendered like: <input name="joomla[foo]" /> and <input name="joomla[bar]" />.
- getGroup() — Method to get an array of JFormField objects in a given field group by name.
- getInput() — Method to get a form field markup for the field input.
- getInstance() — Method to get an instance of a form.
- getLabel() — Method to get the label for a field input.
- getName() — Method to get the form name.
- getValue() — Method to get the value of a field.
- getXml() — Method to get the XML form object
- load() — Method to load the form description from an XML string or object.
- loadFile() — Method to load the form description from an XML file.
- removeField() — Method to remove a field from the form definition.
- removeGroup() — Method to remove a group from the form definition.
- reset() — Method to reset the form data store and optionally the form XML definition.
- setField() — Method to set a field XML element to the form definition. If the replace flag is set then the field will be set whether it already exists or not. If it isn't set, then the field will not be replaced if it already exists.
- setFieldAttribute() — Method to set an attribute value for a field XML element.
- setFields() — Method to set some field XML elements to the form definition. If the replace flag is set then the fields will be set whether they already exists or not. If it isn't set, then the fields will not be replaced if they already exist.
- setValue() — Method to set the value of a field. If the field does not exist in the form then the method will return false.
- validate() — Method to validate form data.