-1

我在 joomla 2.5 中有一个组件。

我有几个视图,其中一个我有一个组合框,当我点击它时,我想调用一个函数,我有这个

<form class="product_filter" action="<?php echo JURI::root()?>index.php/com_productos/buscarCategoria" method="POST">
    <input type="hidden" class="type" name="type" value="HEALTH_FOOD"/>
    <div class="select_wrapper small first">
        <?php echo JHTML::_('select.genericlist', $nameCombo,'name','onChange="this.form.submit()"','value','text'); ?>
    </div>

我的组件的名称是 com_productos 所以在 producto.php 我有这个

class ProductosController extends JController
{
    function buscarCategoria(){
        $jinput = JFactory::getApplication()->input;
        $view = $jinput->getCmd('view', 'productos');
        JFactory::getApplication()->input->set('view', $view);
        $model = &$this->getModel($view);
        $view = &$this->getView($view, 'html');
        $view->setModel($model, true);
        $view->categoria();
    }

但从不执行此功能。

任何的想法

4

2 回答 2

1

您应该在隐藏字段中传递任务(和控制器作为其中的一部分),如下所示:

<input type="hidden" name="task" value="productos.buscarCategoria"/>

而你的动作可以简单的 index.php。

于 2013-03-28T12:29:30.127 回答
0

最后我解决了问题

        <input type="hidden" name="controller" value="field" />
        <input type="hidden" name="option" value="com_productos" />
        <input type="hidden" name="task" value="buscarCategoria" />
    </form>
于 2013-03-28T13:25:15.303 回答