On the registration page when the validations for profile fields fail, the page is refreshed with error messages. The problem is that then the password form is cleared even if the user has already entered an acceptable password. Is there any way to keep the password populated even if the page is refreshed after the validation fails?


The password form field is always cleared out when re-submitting the form after a validation handler reports an error.
There isn't a workaround to that, as the password form field is not using the "#default_value" property that usually other fields would use to pre-populate the fields with a value that is then edited from users. If you use the "#value" (supposing that would have any effect for the password form field) then that value would override the value entered from the users.

  • I always assumed that websites don't echo back the password due to security concerns. If you echo it back it might get stored in the browser cache.
    – uwe
    Jan 11 '12 at 18:50
  • Ok thanks I understand.I thought it was a kinda bad usability especially when there are several validated fields that users often likely fail to pass on the first submission just like my site.
    – chinita7
    Jan 12 '12 at 2:59

I realise this post is old but I had a similar frustration. You can have the password fields not clear on validation by using client side validation.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.