Skip to main content

Password

Password widgetPassword widget

Text input rendered as a mask - in the editor, on the panel row and in the summary. The accepted value stays plain for the consumer. It collects a string.

$p->password('code', 'Order code')
->revealable() // Add a Tab toggle to reveal the typed value.
->confirmation(); // Prompt for the value twice and reject a mismatch.

Runnable scripts: playground/02-widgets/password.php and password-reveal.php.

Options

NameDescriptionRequiredDefault
revealable()Add a reveal toggle: Tab cycles the editor display hidden → masked → plaintext.NoOff
confirmation()Prompt for the value a second time and reject a mismatch before accepting.NoOff

Both are off by default, so a plain password() simply masks the input. revealable only changes what is drawn - the stored value is never affected, and the panel row and summary always stay masked.

With revealable() on, Tab cycles the editor's display through hidden, masked and plaintext, and the hint line shows the toggle:

Password reveal toggle: the value shown as plaintext with a tab reveal hintPassword reveal toggle: the value shown as plaintext with a tab reveal hint

Keyboard

KeyAction
printable keysInsert at the caret (drawn masked)
/ Move the caret
BackspaceDelete the character before the caret
TabCycle the display hidden → masked → plaintext (when revealable())
EnterAccept - or, with confirmation(), re-prompt once, then accept on a match
EscCancel

Display modes

In all four display modes - Unicode or ASCII, colour on or off:

ANSINo ANSI
UnicodePassword: Unicode + ANSIPassword: Unicode + ANSIPassword: Unicode + No ANSIPassword: Unicode + No ANSI
ASCIIPassword: ASCII + ANSIPassword: ASCII + ANSIPassword: ASCII + No ANSIPassword: ASCII + No ANSI