I wrote a custom feeds fetcher class that does an authentication call before it gets the feed. In its settings, I have username and password fields in the form. I tried to set the field #type
to password
, but it seemed not to use the #default_value
element, thus obliterating the saved password when you hit the 'save' button.
This maintains the password, but shows it in plaintext:
$form['password'] = array(
'#type' => 'textfield',
'#title' => t('Password'),
'#description' => t(''),
'#default_value' => $this->config['password'],
);
This shows dots for the password, but does not populate the field using the #default_value
, causing you to have to enter the password any time you want to change and save any value on the form:
$form['password'] = array(
'#type' => 'password',
'#title' => t('Password'),
'#description' => t(''),
'#default_value' => $this->config['password'],
);
I need to be able to have the user enter a password and have it stay no matter what other values they change on the form and save. Does this preclude me from using the password
field type, since it appears not to use the #default_value
element?