Format a single-line text field that does not display its contents visibly.

Parameters

$title: The label for the text field.

$name: The internal name used to refer to the field.

$value: The initial value for the field at page load time.

$size: A measure of the visible size of the field (passed directly to HTML).

$maxlength: The maximum number of characters that may be entered in the field.

$description: Explanatory text to display after the form item.

$attributes: An associative array of HTML attributes to add to the form item.

$required: Whether the user must enter some text in the field.

Return value

A themed HTML string representing the field.

Related topics

2 calls to form_password()
user_admin_create in modules/user.module
user_login in modules/user.module

File

includes/common.inc, line 1249
Common functions that many Drupal modules will need to reference.

Code

function form_password($title, $name, $value, $size, $maxlength, $description = NULL, $attributes = NULL, $required = FALSE) {
  $size = $size ? ' size="' . $size . '"' : '';
  return theme('form_element', $title, '<input type="password" class="' . _form_get_class('form-password', $required, _form_get_error($name)) . '" maxlength="' . $maxlength . '" name="edit[' . $name . ']" id="edit-' . $name . '"' . $size . ' value="' . check_plain($value) . '"' . drupal_attributes($attributes) . ' />', $description, 'edit-' . $name, $required, _form_get_error($name));
}