The subform form field type provides a method for using XML forms inside one another or reuse forms inside an existing form. If attribute multiple is set to true then the included form will be repeatable.
The Field has two predefined layouts for displaying the subform as either a table or as a div container, as well as support for custom layouts.
The subform form field does not provide the Validation and Filters for child fields.
Example XML field definition:
description="Subform Field Description" />
type must be subform.
name is the unique name of the field.
label (translatable) is the descriptive title of the field.
formsource - the form source to be included. A relative path to the xml file (relative to the root folder for the installed Joomla site) or a valid form name which can be found by JForm::getInstance().
description (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.
required - The field must be filled before submitting the form.
message - The error message that will be displayed instead of the default message.
default is the default value, JSON string.
multiple - whether the subform fields are repeatable or not.
min - count of minimum repeating in multiple mode. Default: 0.
max - count of maximum repeating in multiple mode. Default: 1000.
groupByFieldset - whether to group the subform fields by its fieldset (true or false). Default: false.
buttons - which buttons to show in multiple mode. Default: add,remove,move.
layout - the name of the layout to use when displaying subform fields.
The layouts are saved in the folder: layouts/joomla/form/field/subform
The values are stored as object. For example, if subform field (with name sub-form) contains two fields - alpha and beta.
$sub-form = $this->params->get('sub-form');
$arr = (array) $sub-form;
foreach ($arr as $value)