pre populationg password field zend framework
I have created a login form with a remember me checkbox. I have set cookie if the user checks the remember me link. I read the cookie the next time user opens the page. I am able to populate the username field but I'm unable to populate the开发者_StackOverflow社区 password field. Is there any way to populate it?
You have to set "true" to the propertie "renderPassword" like:
$password = new Zend_Form_Element_Password('senha');
$password->renderPassword = true;
$password->setValue("Senha");
You should never pre-populate the password field. You would be taking the user's password and putting it in plain text in the value attribute of the element. Here is an example of implementing remember me functionality in Zend Framework. It may not be 100% current, but its a decent jumping off point.
Although I would recommend against this but you can do this in the following way
<script>
$(document).ready(function(){$('#id_of_the_password_field').val('<?php echo $variable_containing_password;?>');});
</script>
精彩评论