user2262890
user2262890

Reputation: 9

Joomla 2.5 custom mvc component: different form for task add

I'm developing a custom mvc component for Joomla 2.5.

For my admin section I included a "New" button in the toolbar. By clicking this button I want to display a separate form with less fields. So far everything works out but the buttons of the view's toolbar won't redirect (i.e. 'Cancel')

To redirect the task 'add' I added an override of the method "add()" to my controller:

class ArchitectProjectControllerArchitectProject extends JControllerForm
{
    public function add()
    {
        JRequest::setVar('layout',  'add');
        $result = parent::add();
    return $result;
    }
}

I don't know if I'm on the right track. Probably someone can give me a hint?

Upvotes: 0

Views: 525

Answers (1)

Dmitrijs Rekuns
Dmitrijs Rekuns

Reputation: 543

If you wish to redirect for example on 'Cancel' then try the following in the controller:

public function cancel()
{
   $this->setRedirect('index.php?option='.$this->option.'&view=yourview');
}

Upvotes: 1

Related Questions