关闭表单内的cakephp路由

时间:2013-06-11 17:10:33

标签: php cakephp url-routing cakephp-1.3

echo $this->form->create('Cost', array('action' => 'add'));

        echo $this->form->inputs(array(
            'legend' => false,
            'cost_type_id' => array(
                'class' => 'span-8',
                'options' => $cost_types
            )
        ));

        echo $this->html->tag(
            'div',
            $this->form->button(
                sprintf('%s %s',
                    $this->html->image('icons/silk/application_add.png'),
                    __('Create new Cost', true)
                ),
                array(
                    'title' => sprintf('Add')
                )
            ),
            array('class' => 'buttons clearfix')
        );
        echo $this->form->end();

我有一个路由前缀设置,自动将此表单发送到

/prefix/costs/add

有没有办法可以在form->createform->button内关闭它?

1 个答案:

答案 0 :(得分:2)

定义您想要提交表单的路线

echo $this->Form->create('Cost', array(
    'url' => array('prefix'=>null, 'controller' => 'costs', 'action' => 'add')
));

PS:像任何其他路径数组一样更改url数组以满足您的需求。

参考:docs