diff --git a/src/Controls/PasswordRevealInput.php b/src/Controls/PasswordRevealInput.php index 9e79d36..3714ff8 100644 --- a/src/Controls/PasswordRevealInput.php +++ b/src/Controls/PasswordRevealInput.php @@ -14,8 +14,6 @@ class PasswordRevealInput extends TextInput public const string INPUT_CLASS = 'toggle-password-input'; public const string TOGGLE_CLASS = 'toggle-password-reveal'; - private static bool $scriptRendered = false; - public function __construct($label = null, ?int $maxLength = null) { parent::__construct($label, $maxLength); @@ -27,6 +25,7 @@ public function __construct($label = null, ?int $maxLength = null) public function getControl(): Html { $input = parent::getControl(); + $input->value = $this->getRenderedValue(); $button = Html::el('button') ->setAttribute('type', 'button') @@ -37,12 +36,8 @@ public function getControl(): Html $group = Html::el('div') ->setAttribute('class', 'input-group') ->addHtml($input) - ->addHtml($button); - - if (!self::$scriptRendered) { - self::$scriptRendered = true; - $group->addHtml(self::getScript()); - } + ->addHtml($button) + ->addHtml(self::getScript()); return $group; }