Skip to content

WPasswordField

Mark Reeves edited this page Jan 3, 2018 · 14 revisions

WPasswordField is a component for creating an input field with specific constraints for passwords. WPasswordField does not allow content to be sent from the server to the client.

For further information see WTextField; the remainder of this document is concerned with differences between WPasswordField and WTextField.

Why use WPasswordField

WPasswordField should be used whenever an application requires a user to enter a password. An input element in a password state will generally obfuscate the content which, whilst not really providing any real security, provides users with a sense of security. Some of the usability problems inherent in obfuscated input are addressed in some modern browsers by providing a mechanism for a user to 'peek' at a password.

Accessibility

See accessibility notes of WTextField as they all apply to WPasswordField.

Password constraints

If there are specific constraints on a password (for example a requirement for particular combinations of character types) then this constraint should only be included in the WLabel (usually in a hint) for the WPasswordField in situations where the password is being set or reset. They should not be included as a matter of course when a WPasswordField is being used as part of a log-in scenario.

If password contraints are implemented using an input pattern a human-readable version of the constraint must be included in the toolTip.

Sample appearance

WPasswordField creates a simple text input control. When content is entered into the field it is usually obfuscated.

  • WPasswordField in an editable state

    WPasswordField

  • WPasswordField in an editable state with entered content

    WPasswordField

HTML output

A WPasswordField will output a span wrapping a HTML input element in the password state. This is an interactive, form bound control and therefore may not be used in any context where the content model forbids this content category.

When in a read-only state the output will be a HTML span element placeholder with no content: the application cannot send the value of a WPasswordField back to the user.

Read only

When in a read-only state a WPasswordField is merely an empty span element as the application cannot send the value of a WPasswordField back to the user. A WPasswordField should rarely be output in a read-only state. The main exception to this is if the UI allows read-only fields to be made editable using an Action triggered by a WAjaxControl; in which case it may be appropriate to have the empty read-only artefact.

Related components

Further information

Clone this wiki locally