Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Backend action in Joomla doesn't work

Tags:

php

joomla

when i create action and then click on it, i get js error

Uncaught TypeError: Cannot read property 'task' of undefined (in chrome)
TypeError: b is undefined (in ff)

my code is:

view.html.php

<?// no direct access

defined( '_JEXEC' ) or die( 'Restricted access' );

jimport( 'joomla.application.component.view');


class ObshViewObsh extends JView
{

    function display($tpl = null)
    {

        $task = JRequest::getVar('task', '');
        switch($task){            
            case 'config': $this->config();break;
            default: $this->windows();
        }

        parent::display($tpl);
    }

    function windows(){
        JToolBarHelper::title( JText::_( 'Общежития' ), 'generic.png' ); 
        JToolBarHelper::custom('config','options','','Настройки',false); //<<< --- this link doesn't work

    }

     function config(){
        JToolBarHelper::title( JText::_( 'Общежития - настройка компонента' ), 'generic.png' );
        JToolBarHelper::apply('edit_config');
        JToolBarHelper::cancel('cancel');    
    }          

}

controller.php

<?php
 error_reporting(E_ALL);
// No direct access

defined( '_JEXEC' ) or die( 'Restricted access' );

jimport('joomla.application.component.controller');


class ObshController extends JController
{       

    function config(){
        JRequest::setVar( 'view', 'obsh' );
        JRequest::setVar( 'layout', 'config'  );
        JRequest::setVar( 'hidemainmenu', 1 );
        parent::display();
    }        
}
like image 601
alhimikst Avatar asked Aug 25 '12 08:08

alhimikst


1 Answers

answer is simple as hell...

i forgot to add form in view

<form action="index.php" method="post" name="adminForm">

    something

    <input type="hidden" name="option" value="com_obsh" />
    <input type="hidden" name="task" value="" />
    <input type="hidden" name="boxchecked" value="0" />
</form>
like image 171
alhimikst Avatar answered Oct 15 '22 05:10

alhimikst