ZF-9684: Zend_Dojo_Form_Element_Reset

Description

For time being, there is no Zend_Dojo_Form_Element_Reset-class, I'd like to propose such a class, which enables resetting dojo-forms (analog to Zend_Form_Element_Reset).

Comments

This can be done by modifying the submit class like:


class Zend_Dojo_View_Helper_ResetButton extends Zend_Dojo_View_Helper_Button
{
    /**
     * @var string Reset input
     */
    protected $_elementType = 'reset';

    /**
     * dijit.form.Button tied to reset input
     *
     * @param  string $id
     * @param  string $value
     * @param  array $params  Parameters to use for dijit creation
     * @param  array $attribs HTML attributes
     * @return string
     */
    public function resetButton($id, $value = null, array $params = array(), array $attribs = array())
    {
        if (!array_key_exists('label', $params)) {
            $params['label'] = $value;
        }
        if (empty($params['label']) && !empty($params['content'])) {
            $params['label'] = $params['content'];
            $value = $params['content'];
        }
        if (empty($params['label']) && !empty($attribs['content'])) {
            $params['label'] = $attribs['content'];
            $value = $attribs['content'];
            unset($attribs['content']);
        }
        return $this->_createFormElement($id, $value, $params, $attribs);
    }
}

and


class Zend_Dojo_Form_Element_ResetButton extends Zend_Dojo_Form_Element_Button
{
    /**
     * Use ResetButton dijit view helper
     * @var string
     */
    public $helper = 'ResetButton';
}

Hope this is added in upcoming release. This work fine in my code.