Skip to content

password

password fields are identical to string fields except that the user's input is visually obscured, they do not support the textarea option, and they are not indexed for search.

Module field definition

javascript
// Configuring the `secret` field in a module's `fields.add` subsection:
secret: {
  label: 'Your secret code',
  type: 'password'
}

Settings

Required

PropertyTypeDefaultDescription
labelStringn/aSets the visible label for the field in the UI
typeStringn/aSpecifies the field type (password for this type)

Optional

PropertyTypeDefaultDescription
autocompleteStringn/aSets the value of the autocomplete attribute on the field.
defStringn/aThe default value for the field
helpStringn/aHelp text for the content editor
htmlHelpStringn/aHelp text with support for HTML markup
minIntegern/aSets the minimum number of characters allowed
maxIntegern/aSets the maximum number of characters allowed
requiredBooleanfalseIf true, the field is mandatory
ifObject{}Conditions to meet before the field is active. See the guide for details.
requiredIfObject{}Conditions to meet before the field is required. See the guide for details.
readOnlyBooleanfalseIf true, prevents the user from editing the field value

autocomplete

The string supplied to the autocomplete option is used as the value of the autocomplete attribute for the field, as specified in the HTML standards. This feature suggests possible values based on user inputs and previously entered data, streamlining data entry and improving form usability. This also takes a string of off to disable autocomplete for sensitive fields. However, most modern browsers ignore this for password fields. In situations where you are implementing a user management page and an administrator will be adding a password for another user pass a string of new-password to truly disable auto-complete. For detailed information on how the autocomplete attribute works and the values it accepts, refer to the MDN documentation on autocomplete.

Use in templates

You probably do not want to print values from this field in templates, but they can be printed the same way as string fields.