I have created an edit view for my fields view. When I click any button (save, save & close, cancel) it does nothing. Here is my AddToolbar code:
protected function addToolbar() {
JFactory::getApplication()->input->set('hidemainmenu', true);
$user = JFactory::getUser();
$isNew = ($this->item->id == 0);
if (isset($this->item->checked_out)) {
$checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id'));
} else {
$checkedOut = false;
}
$canDo = ReportsHelper::getActions();
JToolBarHelper::title(JText::_('COM_REPORTS_TITLE_NEWREPORT'), 'newreport.png');
// If not checked out, can save the item.
if (!$checkedOut && ($canDo->get('core.edit') || ($canDo->get('core.create')))) {
JToolBarHelper::apply('field.apply', 'JTOOLBAR_APPLY');
JToolBarHelper::save('field.save', 'JTOOLBAR_SAVE');
}
if (!$checkedOut && ($canDo->get('core.create'))) {
JToolBarHelper::custom('field.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
}
// If an existing item, can save to a copy.
if (!$isNew && $canDo->get('core.create')) {
JToolBarHelper::custom('field.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
}
if (empty($this->item->id)) {
JToolBarHelper::cancel('field.cancel', 'JTOOLBAR_CANCEL');
} else {
JToolBarHelper::cancel('field.cancel', 'JTOOLBAR_CLOSE');
}
}
Here is my code in the controller file: Field.php:
jimport('joomla.application.component.controllerform');
class ReportsControllerField extends JControllerForm
{
}
The toolbars do not seem to work. What's wrong with my code?
I resolved my problem by re-creating the display form in /views/fields/tmpl/edit.php. Seems I mistyped the form name. After re-creating, the toolbars worked.