dessi
dessi

Reputation: 27

Save and back button redirect to wrong template

I created my first Joomla 3.6.2 component and everything's working fine - until ONE thing.

I click on a link in an overview template and reac the edit view. Now, if I click on Back-Button or Save-Button, he redirects me to a templatename which name doesn't exists anywhere (searched the whole project folder).

When I click on them, it seems to be my browser redirects to the singular word of it.... the view name on editing is "ladies" and he uses "lady" after clicking....

Any Ideas?

Upvotes: 1

Views: 823

Answers (1)

Arek Szczerba
Arek Szczerba

Reputation: 458

Joomla by default switch between singular and plural names.

When you are in Edit View and click 'Save' or 'Cancel' button joomla tries to redirect you into List view, and automatic add 's' to your view name.

You can overwrite default 'Save' and 'Cancel' methods in your controller file.

public function save($key = null, $urlVar = null) {
    $return = parent::save($key, $urlVar);
    $this->setRedirect(JRoute::_('index.php?option=com_helloword'));
    return $return;
}

public function cancel($key = null, $urlVar = null) {
    $return = parent::cancel($key, $urlVar);
    $this->setRedirect(JRoute::_('index.php?option=com_helloword'));
    return $return;
}

Please take a look at this post. https://stackoverflow.com/a/16113039/5088581

Upvotes: 3

Related Questions