Issues

ZF-9684: Zend_Dojo_Form_Element_Reset

Issue Type: Sub-task Created: 2010-04-15T05:47:47.000+0000 Last Updated: 2012-05-21T10:51:15.000+0000 Status: Open Fix version(s): Reporter: Markus Schulte (schultemarkus) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend_Dojo

Related issues: Attachments:

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

Posted by Shaun Freeman (vincentbluff) on 2011-09-13T18:40:32.000+0000

This can be done by modifying the submit class like:

<pre class="highlight">
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

<pre class="highlight">
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.

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts