Zend form: image as submit button
Zend talk.I need two submit buttons in my Zend_form so that after populating or validating the form, I can check wich button was clicked using the isChecked() method.
Since now I used the Zend_Form_Element_Submit but what if I want to use an Image as submit button?
Using the Zend_Form_Element_Image is the right solution?Do I need to set its attribute "type=submit"?Would the is checked method still available on this element?
thanks
开发者_运维技巧Luca
The Zend_Form_Element_Image is the correct element to use, the type will set to image automatically. If you want to check if the button was clicked in your controller then simply use
if (isset($this->_request->buttonname_x))
or
if (isset($this->_request->buttonname_y))
as the browser will return the XY coordinates of the pointer on the image.
I hope this helps.
Kind regards
Garry
精彩评论