XMLForm is RicheyWeb’s free Joomla plugin for custom fields, offering unmatched flexibility to define forms and render outputs your way. Originating from a 2017 JSON-encoding pull request (#19025), it evolved from the SubForm plugin into "XMLForm" after Joomla 4’s 2021 "Subform" field caused a namespace conflict. After a 2018 win to protect "fields_subform" (leading to the core’s "SubFields"), the Joomla 4 shift prompted a refactor. Unlike "Fields - Subform" (a paid RicheyWeb plugin with a 2024 core pull request), XMLForm is a free, developer-focused tool for limitless customization.

Installation

  • Download plg_fields_xmlform.zip from richeyweb.com or the Joomla Extensions Directory.
  • In Joomla admin, go to Extensions > Manage > Install, upload the ZIP, and install.
  • Enable the plugin under Extensions > Plugins (search “XMLForm”, set to “Enabled”).

Usage

Creating a New Custom Field

To harness XMLForm’s power, create a custom field in your Joomla site with these steps:

  1. Navigate to the Fields Manager:
    • Go to Content > Fields in the Joomla admin panel (or Users > Fields or Contacts > Fields, depending on your context).
    • Click the New button to add a new custom field.
  2. Select Field Type:
    • Choose XMLForm (xmlform) from the field type dropdown. This is the specific type provided by the XMLForm plugin.
  3. Configure the Field:
    • Title: Enter a descriptive name (e.g., “Custom Form Data”).
    • Name: Automatically generated or manually set (e.g., customformdata), used in the database.
    • Form Source: Specify the path to your XML form file relative to Joomla’s root (e.g., subforms/myform.xml). Create this file with your desired fields (see “Define Your Form” below).
    • Load Language: Optional. Set to “Yes” to enable translations if your XML uses language keys and you’ve added a language file (e.g., subforms/myform/language/en-GB/myform.ini).
    • Load Template: Optional. Set to “Yes” to use a custom PHP template for output (e.g., subforms/myform.php).
    • Groupby Fieldset: Optional. Set to “Yes” to group fields by fieldset in the form display (useful for organizing complex forms).
    • Multiple: Optional. Set to “Yes” to allow multiple instances of the form (e.g., repeatable entries).
    • Access, Required, etc.: Adjust as needed for your use case.
  4. Save and Test:
    • Save the field. It will appear in your content (e.g., articles) where you can input data based on the XML form.
    • Check the front-end output—use the default table view or your custom template to see the results.

Note: XMLForm stores data as JSON, enabling complex structures. The default output is a basic table, but I encourage you to code custom templates for unique displays (e.g., meta tags, 3D visuals).

Define Your Form

  1. Create an XML file (e.g., subforms/myform.xml) in a directory of your choice (I use JPATH_ROOT/subforms/ for simplicity).
  2. Define your form structure using Joomla’s form XML syntax. Example:
    
    <?xml version="1.0" encoding="UTF-8"?>
    <form>
        <field name="title" type="text" label="Title" description="Enter a title" required="true" />
        <field name="description" type="textarea" label="Description" rows="3" />
    </form>
    
  3. Add custom field paths with <fieldset addfieldpath="path/to/fields"> if using custom types (e.g., subforms/myform/fields/).

It works exactly like every other Joomla Form XML you've ever written!

Customize Output

  • Use the default table output by leaving Load Template and customtemplate unset.
  • For custom rendering, create a PHP file (e.g., subforms/myform.php) and set Load Template to “Yes” or customtemplate to subforms/myform.php. Example:
    
    <?php
    defined('_JEXEC') or die;
    $value = $field->value;
    if (!empty($value['title'])) {
        echo '<h2>' . htmlspecialchars($value['title']) . '</h2>';
    }
    if (!empty($value['description'])) {
        echo '<p>' . htmlspecialchars($value['description']) . '</p>';
    }
    ?>
    
  • Inject meta tags or scripts using Factory::getDocument()->setMetaData() or addScriptDeclaration().

Frequently Asked Questions:

How do I use this software?

If the above document doesn't get you started, then you don't have the requisite knowledge to use this software.

How do I get the required knowledge to use this software?

Language courses, tutorials, and years of experience.