ZF-8475: Dojo form button can't submit a value

Description

this bug is related to this one http://framework.zend.com/issues/browse/ZF-5056. But for Zend_Form there is a workaround - just to use Zend_Form_Element_Submit instead of Zend_Form_Element_Button, for Zend_Dojo_Form_Element_Button there is no alternative


$form = new Zend_Dojo_Form()
$form->setMethod('post')
$button = new Zend_Dojo_Form_Button(
    'Save',
    array(              
        'label'     => 'Save',
        'id'        => 'id',
        'type'      => 'Submit',
        'value'     => 'Save',
    )
);
$form->addElement($button);
$form->populate($_POST);

$form->getElement('Save')->isChecked();

isChecked() will never return true (tested FF, IE8, Chrome, Safari, Opera), because value attribute of button is always empty due to the way Zend_Form_Decorator_ViewHelper works (it just never gives button a value attribute!)

Comments

Use Zend_Dojo_Form_SubmitButton if you need a submittable dijit.form.Button, or provide an onclick callback that submits the button: ``` $button = new Zend_Dojo_Form_Button( 'Save', array(
'label' => 'Save', 'id' => 'id', 'type' => 'Submit', 'value' => 'Save', 'onclick' => 'dijit.byId("formid").submit()', ) ); {note}