Index: Form/Element/Password.php
===================================================================
--- Form/Element/Password.php (revision 8741)
+++ Form/Element/Password.php (working copy)
@@ -40,7 +40,31 @@
*/
public $helper = 'formPassword';
+ public $options = array();
+
/**
+ * should the entered password be rerendered when form is rerendered due to error (or success)
+ *
+ * @param bool $flag
+ * @return Zend_Form_Element_Password $this
+ */
+ public function setRenderPassword($flag) {
+ + $this->options['renderPassword'] = (bool) $flag;
+ return $this;
+ }
+
+ /**
+ * returns whether passord will be rerendered when form is rerendered due to error (or success)
+ *
+ * @return bool
+ */
+ public function getRenderPassword() {
+ + return !empty($this->options['renderPassword']);
+ }
+
+ /**
* Override isValid()
*
* Ensure that validation error messages mask password value.
Index: View/Helper/FormPassword.php
===================================================================
--- View/Helper/FormPassword.php (revision 8741)
+++ View/Helper/FormPassword.php (working copy)
@@ -52,9 +52,9 @@
*
* @return string The element XHTML.
*/
- public function formPassword($name, $value = null, $attribs = null)
+ public function formPassword($name, $value = null, $attribs = null, $options = null)
{
- $info = $this->_getInfo($name, $value, $attribs);
+ $info = $this->_getInfo($name, $value, $attribs, $options);
extract($info);
@@ -69,11 +69,17 @@
if (($this->view instanceof Zend_View_Abstract) && !$this->view->doctype()->isXhtml()) {
$endTag= '>';
}
+
+ + + if(empty($options['renderPassword'])) {
+ $value = '';
+ }
$xhtml = '<input type="password"'
. ' name="' . $this->view->escape($name) . '"'
. ' id="' . $this->view->escape($id) . '"'
- . ' value=""' + . ' value="' . $this->view->escape($value) . '"'
. $disabled
. $this->_htmlAttribs($attribs)
. $endTag;