6 - Site Side - Form Display

To display the form you can use again the BpForm class.


<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
?>
<form name="formName" id="formId" action="my_form_action.php" method="post" enctype="multipart/form-data">
<?php
// only parse a specific fieldset
echo BpForm::parseForm($this->form'fieldset_name');
 
echo 
JHtml::_('form.token');

// you may want to add actions buttons using a common layout you can use in all your extension's views

// BUTTONS
$layout Bp::loadLayout'my_buttons_layout''my_folder_name_inside_layouts_folder');
$html $layout->render( array('data' => 'for_buttons'));
echo 
$html;

?>
</form>

We know that in site side you may want to display the form in a lot of different layouts so the class only parse just a form's fieldset, the one you pass as second parameter.

If your form has 5 fieldsets (to say), you have to repeat the command 5 times. This gives you the option to design a very complex layout (like Joomla's general configuration in admin side, for example) with just few lines of html and then just parse the specific fieldset in each box.

Uikit

As Uikit (https://getuikit.com/) is de-facto a standard for Joomla's site templates, if your template already support it you may want to use BpForm::parseFormUk($form, 'fieldset_name') instead, which uses uikit form standard.

Cool, isn't it?