1. NOTICE: If you are using Fabrik and update to Joomla 3.10, you will need to update to Fabrik 3.10. And, if you are using Fabrik, do not upgrade to Joomla 4, we do not have a supported version ready for release. More information on a release date coming soon. Also, please note that Fabrik 3.10 will not install on any Joomla sites less than 3.8.
    Dismiss Notice

Render a single element in a form

Apr 9, 2019
Render a single element in a form
  • In your form templates, elements are rendered in the sub template default_group.php


    Is an array of element objects, keyed on the element name.
    By default the default_group.php sub template loops over the element's and renders them all out.

    Often in a custom template we want to get a specific element, so if I wanted to access the element named 'age' I could do:


    $ageElement = $this->elements['age'];
    Each element is an object with a series of properties:
    • plugin - the element's plugin e.g. 'field'
    • id - Unique reference, e.g. 'tablename___name'
    • element - the HTML field e.g. <input .... />
    • label_raw - the label as plain text
    • label - the label text wrapped in its <label/> tag
    • value - the value assigned to the element
    • error - any error message generated from a fail validation
    • column (fabrik 3.0 only) css used to build group columns
    To output the element's value we can write this PHP:

    echo $ageElement->value;