Password field being blanked if "Add" does not succeed.

I’m building my app_form_add_users and testing it. If there is something on the form that is incorrect, or the entered Login ID is a duplicate with one that is already in the database, an error message is displayed, which is all ok. However, when the user closes the error message, the password and confirm password fields are blanked out. This is very annoying because it may take several tries for the user to invent a unique Login ID. This means that on each fail, the user must re-enter the password and confirm password.

How can I tell the password and confirm password field to retain their values, even if an error message is displayed?