views:

24

answers:

1

Zend_Form action and method shows by default <form action="" method="post">

... My wish is not like that... Just be written <form> .. Is that possible ??

How can I do ???

A: 

well you can simply do the following but there really is no reason to to this! why would you want en empty form tag?

add this to your config to let the framework "know" your new helper

resources.view.helperPath.My_View_Helper = "My/View/Helper"

then in the file library/My/View/Helper.php create the class

class My_View_Helper_Form extends Zend_View_Helper_Form
{
    /**
     * Render HTML form without any attributes on the form-tag
     *
     * @param  string $name Form name
     * @param  null|array $attribs HTML form attributes
     * @param  false|string $content Form content
     * @return string
     */
    public function form($name, $attribs = null, $content = false)
    {
        $info = $this->_getInfo($name, $content, $attribs);
        extract($info);

        if (!empty($id)) {
            $id = ' id="' . $this->view->escape($id) . '"';
        } else {
            $id = '';
        }

        if (array_key_exists('id', $attribs) && empty($attribs['id'])) {
            unset($attribs['id']);
        }

        $xhtml = '<form>';

        if (false !== $content) {
            $xhtml .= $content
                   .  '</form>';
        }

        return $xhtml;
    }
}

it will automatically be used when you have configured your view resource properly

zolex