Joomla repeatable Form Field Type

It provides a modal with rows of form fields that you specify. As many options can be added as the user desires. This form field has a jQuery based javascript file as a dependency.

To create a form field, first create a repeatable form field as usual. The fieldset tag must have a name the same as your repeatable field name with "_modal" appended to the end of it. It should also have the in the fieldset tag.

Within this fieldset, then include the form fields that you wish to have repeating (as with any form field).

Example XML Definition

<field name="list_templates"
default='{"template":["Layout","Simple snippet"],
"description":["HTMLLayout","Simple HTML snippet"]}'>
<fieldset hidden="true" name="list_templates_modal" repeat="true">
<field name="template"
type="text" />
<field name="location"
hide_none="true" />
<field name="description"
type="textarea" />


Mandatory Parameters

  • name is the unique name of the parameter.
  • type must be repeatable.
  • label (translatable) is the descriptive title of the field.

Optional Parameters

  • description: description text for the form field. Displays at the top of the modal with the name as well as in the usual position in the form.
  • default: The default value for the form field if the field is left empty. This has to be a json string compatible with the contents of the form field.
  • id: id of the hidden form field. The modal will have this id with an added suffix of "_modal" and the table within the modal will have this id with a suffix of "_modal_table".
  • class: class of the table.
  • select (translatable): The text to show on the modal button.
  • icon: The icon to show on the select button (is prefixed with "icon-").
  • maximum: The maximum number of rows of fields allowed (by default 999 to be effectively infinite).

Considerations for the default value

  • The default may contain spaces, tabs and new lines for better readability.
  • The data elements within the string must be quoted using " instead of '. Failure to do so will cause the json decode to fail on the default values. 

Retrieving data

The settings of a repeatable form field are returned as a json encoded array (same as the default).

// get the repeatable field value and decode it
$list_hosts = json_decode( $params->get('list_templates'),true);
// loop your result
foreach( $list_templates as $list_templates_idx => $list_template ) {
// do something clever for each of the templates


Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive