Joomla中的后端操作无效

alh*_*kst 8 php joomla

当我创建动作,然后单击它,我得到js错误

未捕获的TypeError:无法读取未定义的属性"任务"(在chrome中)
TypeError:b未定义(在ff中)

我的代码是:

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');    
    }          

}
Run Code Online (Sandbox Code Playgroud)

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();
    }        
}
Run Code Online (Sandbox Code Playgroud)

alh*_*kst 12

答案很简单就像......

我忘了在视图中添加表单

<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>
Run Code Online (Sandbox Code Playgroud)

  • 这对我来说也不起作用,因为我在Joomla 3.我需要在<form>标签中添加id ="adminForm"以使其启用. (6认同)