Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>It's a little bit tricky but not impossible :</p> <p>You need to implement your own view helper and use it with your element.</p> <p>At first, you must add a custom view helper path :</p> <p><a href="https://stackoverflow.com/questions/2335545/how-to-add-a-view-helper-directory-zend-framework">How to add a view helper directory (zend framework)</a></p> <p>Implement your helper :</p> <pre><code>class View_Helper_CustomSubmit extends Zend_View_Helper_FormSubmit { public function customSubmit($name, $value = null, $attribs = null) { if( array_key_exists( 'value', $attribs ) ) { $value = $attribs['value']; unset( $attribs['value'] ); } $info = $this-&gt;_getInfo($name, $value, $attribs); extract($info); // name, value, attribs, options, listsep, disable, id // check if disabled $disabled = ''; if ($disable) { $disabled = ' disabled="disabled"'; } if ($id) { $id = ' id="' . $this-&gt;view-&gt;escape($id) . '"'; } // XHTML or HTML end tag? $endTag = ' /&gt;'; if (($this-&gt;view instanceof Zend_View_Abstract) &amp;&amp; !$this-&gt;view-&gt;doctype()-&gt;isXhtml()) { $endTag= '&gt;'; } // Render the button. $xhtml = '&lt;input type="submit"' . ' name="' . $this-&gt;view-&gt;escape($name) . '"' . $id . ' value="' . $this-&gt;view-&gt;escape( $value ) . '"' . $disabled . $this-&gt;_htmlAttribs($attribs) . $endTag; return $xhtml; } } </code></pre> <p>So, you assign the helper to the element :</p> <pre><code>$submit = $form-&gt;createElement( 'submit', 'submitElementName' ); $submit-&gt;setAttrib( 'value', 'my value' ); $submit-&gt;helper = 'customSubmit'; $form-&gt;addELement( $submit ); </code></pre> <p>This way, you can retrieve the value of the submitted form :</p> <pre><code>$form-&gt;getValue( 'submitElementName' ); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload