1. Fabrik 3.9 has been released. If you have updated Joomla to 3.9, this is a required update.
    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;