Web development & Optimization

Every module form consists of parameters settings fields and if it is image slider module, that form need to have options to add caption or title text on every image/slide, link and maybe other options. That would be form with repeatable sections (Image1, Caption1, Link1, Image2, Caption2, Link2 etc.) and if we have 5 or more sections that would be very long user form. However, for that case Joomla 3 has repeatable form field type that allows you to add unlimited number of repeatable sections.

Social Share module

Here is similar problem, need to make Social Share module with option to select at least 30 social share networks (Facebook, Twitter, Pinterest, Google Plus, Linkedin, etc.). What we've got here is that we need at least two option for every social network: title (or image, or icon) and share url. Here is the question: What principle to use to create user interface with 60 inputs (2x30)? We don't want to use 60 input fields because that would be very, very long user form, for that case let us consider Joomla repeatable form field type.

Repeatable Joomla form field type

Repeatable form field type allows us to insert unlimited number of repeatable sections, but currently, if we want to use repeatable field first we need to replace repeatable javascript file and add patch to Joomla (currently 3.3.6). Here (on GitHub) is the group of Joomla developers with solutions for finall version. Because repeatable field is still in progress I decided to find another solution for my problem.

Multiplier module

We need form to insert one row of data, press "Add" button, and repeat same process. That is main target - use one form to add multiple rows of data.
Data will be stored inside hidden field (container) in JSON format, and everything is object (field, row and rows). This will allow us (later) advanced options, and also we need to get this concept works with all Joomla form field types. User interface must have options to drag and drop rows of data, pagination (if we have dozens of rows), search and edit row.

Theoretically, it would be possible to create section with 10 fields ("page" elements), and if we want, we can create dozens of "pages" inside one module. But need to notice that all that data are stored inside one database cell - and we need to respect that! It is Joomla module - not component. That about "pages" I write as an example, and it is not recommended. 

repeatable fields multiplier module

Details and usage

If you need to build this type of module (repeatable section module), at the bottom of this page you can download module "mod_multiplier", and all what you need to do is to (re)place fields inside xml file, and call them inside default.php file.

After download and install Multiplier module, you will find that in module administration you have two fields "city" and "country". That is for demonstration purposes only, you can play a while with module to see how it's works. Game is to write country in which is selected city (eg. Paris, France etc.). Also, do not forget to set module position to see result.

Instruction notes:

  • Repeatable fields need to go inside "wrapper"
  • Call your fields by name inside default.php file (tmpl/default.php)
  • Reserved fields are: "wrapper", "repeater", and "content" !!!


<fieldset name="basic" addfieldpath="/modules/mod_multiplier/models/fields">
<!-- Wrapper is container for repeatable fields-->
<fields name="wrapper">

<!--This is the place where you insert your fields-->

<field name="repeater" label="" type="repeater" />
<field name="content" hidden="true" label="Content" type="hidden"/>


Calling fields inside tmpl/default.php

Hierarchical data structure has 3 levels: rows, row and field. All rows are inside $rows variable, and later we get our fileds values through foreach loop inside default.php.

all data = $rows
one row of data = $row
one field = $row->field_name

Practical example:

Inside "wrapper" are fields "country", and "city" and we call them inside tmpl/default.php like this:

<?php foreach ($rows as $row):?>
<?php echo $row->country;?>:<?php echo $row->city;?>
<?php endforeach; ?>

Is it possible to install more different mod_multiplier instances?

Yes. You need to rename module and install it.

1. You need to replace all appearance of "_multiplier" into "_your_module_name" ("find and replace")
2. Edit Class name in helper.php from "Multiplier" to "YourModuleName"
3. Edit mod_your_module_name.php file, line 17. to new class name (step 2)

As example, download mod_share_list because it was made using mod_multiplier.

Next release plans

  • add rows ordering option, edit rows, search, pagination
  • online module generator


Please note that I finished new version of this module. There are advanced options like ordering, drag and drop, edit etc. Fore more information please contact me.


  • File Name: mod_multiplier.zip
  • Date Created: 2014
  • Version: 1.0
  • Size: 8KB
  • Download
  • File Name: mod_share_list.zip
  • Date Created: 2014
  • Version: 1.0
  • Size: 36KB
  • Download