PasswordField

This is a text field that displays echo characters instead of those entered by a user.

Component’s XML-name: passwordField.

Basics

The PasswordField is similar to TextField apart from the ability to set datatype. PasswordField is intended to work with text and entity attributes of type String only.

An example of the PasswordField:

<passwordField id="passwordField"
               caption="Secret password field"/>
@Autowired
private PasswordField passwordField;
@Autowired
private Notifications notifications;

@Subscribe("showPasswordBtn")
protected void onShowPasswordBtnClick(Button.ClickEvent event) {
    notifications.create()
            .withCaption(passwordField.getValue())
            .show();
}
password field

Attributes

  • The autocomplete attribute allows you to enable saving passwords in the web browser. It is disabled by default.

  • The capsLockIndicator attribute allows you to set the id of a CapsLockIndicator component that should indicate Caps Lock state for this passwordField.