4 - The item form

Managing the form can't be easier.

administrator / components / com_dealer / car / edit.php


<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use 
Joomla\Registry\Registry;

JHtml::_('behavior.formvalidator');
JHtml::_('behavior.keepalive');
JHtml::_('bootstrap.tooltip');


// OPTIONS //////////////////////////////////////////////
// PASS ALL OPTIONS AS ARRAY
$options = array();
//
// DO WE REQUIRE FULL PAGE WIDTH?
$options['span12'] = true;
//
//
// DO WE REQUIRE A VERTICAL FORM
// like:    label
//          field
// OR HORIZONTAL
// like     label   field
// options: horizontal
//          vertical
$options['form_display'] = 'horizontal';

echo 
BpForm::adminEdit($this->form,  $options$this->sidebar '');

In the example we have disabled the sidebar submenu getting advantage of the full screen width ($options['span12'] = true;)

We also instructed the method to list labels and fields on the same row ($options['form_display'] = "horizontal";).

If you have more than one fieldset in the form, the method will split them in tabsets automatically without any further instructions. You can even include name and description in each form fieldset and the method will manage them accordingly.

Just to name a few, the long list of customizations allow you to:

  • include or not the form tags
  • include or not the send button
  • include or not a return link
  • disable the tabset

and much more...

To get a full list of options have a look inside the BpForm class code and, even better, give it a try. You'll never want to go back.

Now let's go to have a look at the site side in the next chapter.