Quick links: Content - sections - sub sections
EN FR

With jForms, you can also display not the form but only its data. It can be useful as a reporting of input steps for example.

Automatic or default display

For you in hurry, this template plugin will fully display your form data. its name: formfull. With it, you won't control how each controls labels and values are displayed. Just pass it your form object.

Here is an example, in a controller :


    $form = jForms::get('myform');
    $tpl = new jTpl();
    $tpl->assign('form', $form);

Et dans le template :


   <h1>Your form</h1>
   <p>Your inputs:</p>

   {formdatafull $form}

Form labels and values are displayed in a table.

Note : you can use formdatafull in a text response template.

Customized display

As for form display, you can control how your form data are displayed and precisely in which markup labels and values are wrapped.

Use {formcontrols} and {ctrl_label} plugins similarly to form display and also {ctrl_value} :


   <h1>Your form</h1>
   <p>Your inputs:</p>

   <table>
    {formcontrols $form}
       <tr>
           <th scope="row">{ctrl_label}</th>
           <td>{ctrl_value}</td>
       </tr>
    {/formcontrols}
    </table>

Note: {form} is not needed here as oppposed to complete form display .

You are also free to not use {formcontrols} loops, and display only your labels and values of choice, in which ever order. To achieve this, use {ctrl_label} and {ctrl_value} and call them with your selected control names. But they msut be used inside a {formdata} plugin:


   <h1>Your form</h1>
   <p>Your inputs:</p>

   <table>
    {formdata $form}
       <tr>
           <th>{ctrl_label 'name'}</th>
           <td>{ctrl_value 'name'}</td>
       </tr>
       <tr>
           <th>{ctrl_label 'address'}</th>
           <td>{ctrl_value 'address'}</td>
       </tr>
    {/formdata}
    </table>