Sha256: 4a5adcfd7c3483b0fb0131e7acfd3136e7b176e33b9e6d413279d206fb25f245

Contents?: true

Size: 1.43 KB

Versions: 1788

Compression:

Stored size: 1.43 KB

Contents

<%= pb_rails("passphrase", props: { classname: "pass_input_1" }) %>

<%= pb_rails("passphrase", props: { confirmation: true, classname: "pass_input_2"}) %>

<div id="match"> </div>

<%= javascript_tag do %>
    window.addEventListener("DOMContentLoaded", () => {   

      const useState = (defaultValue) => {
          let value = defaultValue;
          const getValue = () => value
          const setValue = (newValue) => {
              return value = newValue
          }
          return [getValue, setValue];
      }

      const [input, setInput] = useState('')
      const [confirmationInput, setConfirmationInput] = useState('')

      const match = document.querySelector("#match")

      const input1 = document.querySelector(".pass_input_1").querySelector("input")
      const input2 = document.querySelector(".pass_input_2").querySelector("input")

      input1.addEventListener('input', (e) => {
          setInput(e.target.value)
          setMatchText()
      });

      input2.addEventListener('input', (e) => {
          setConfirmationInput(e.target.value)
          setMatchText()
      });

      const setMatchText = () => {

        if (input() && confirmationInput()) {
          if (input() === confirmationInput()) {
              match.textContent = "They match!"
          } else {
              match.textContent = "They don't match!"
          }
        } else {
          match.textContent = ""
        }

      }
    })
<% end %>

Version data entries

1,788 entries across 1,788 versions & 2 rubygems

Version Path
playbook_ui_docs-14.11.1.pre.alpha.PLAY17445539 app/pb_kits/playbook/pb_passphrase/docs/_passphrase_confirmation.html.erb
playbook_ui-14.11.1.pre.alpha.PLAY17445539 app/pb_kits/playbook/pb_passphrase/docs/_passphrase_confirmation.html.erb
playbook_ui_docs-14.11.1.pre.alpha.PBNTR798datepickerturbo5537 app/pb_kits/playbook/pb_passphrase/docs/_passphrase_confirmation.html.erb
playbook_ui-14.11.1.pre.alpha.PBNTR798datepickerturbo5537 app/pb_kits/playbook/pb_passphrase/docs/_passphrase_confirmation.html.erb
playbook_ui_docs-14.11.1.pre.alpha.pbntr703collapsiblerowsrails5536 app/pb_kits/playbook/pb_passphrase/docs/_passphrase_confirmation.html.erb
playbook_ui-14.11.1.pre.alpha.pbntr703collapsiblerowsrails5536 app/pb_kits/playbook/pb_passphrase/docs/_passphrase_confirmation.html.erb
playbook_ui_docs-14.11.1.pre.alpha.PLAY1751pbcontenttagpt25529 app/pb_kits/playbook/pb_passphrase/docs/_passphrase_confirmation.html.erb
playbook_ui-14.11.1.pre.alpha.PLAY1751pbcontenttagpt25529 app/pb_kits/playbook/pb_passphrase/docs/_passphrase_confirmation.html.erb
playbook_ui_docs-14.11.1.pre.alpha.PBNTR7495495 app/pb_kits/playbook/pb_passphrase/docs/_passphrase_confirmation.html.erb
playbook_ui-14.11.1.pre.alpha.PBNTR7495495 app/pb_kits/playbook/pb_passphrase/docs/_passphrase_confirmation.html.erb
playbook_ui_docs-14.12.0.pre.rc.11 app/pb_kits/playbook/pb_passphrase/docs/_passphrase_confirmation.html.erb
playbook_ui-14.12.0.pre.rc.11 app/pb_kits/playbook/pb_passphrase/docs/_passphrase_confirmation.html.erb
playbook_ui_docs-14.12.0.pre.rc.10 app/pb_kits/playbook/pb_passphrase/docs/_passphrase_confirmation.html.erb
playbook_ui-14.12.0.pre.rc.10 app/pb_kits/playbook/pb_passphrase/docs/_passphrase_confirmation.html.erb
playbook_ui_docs-14.12.0.pre.rc.9 app/pb_kits/playbook/pb_passphrase/docs/_passphrase_confirmation.html.erb
playbook_ui-14.12.0.pre.rc.9 app/pb_kits/playbook/pb_passphrase/docs/_passphrase_confirmation.html.erb
playbook_ui_docs-14.12.0.pre.rc.8 app/pb_kits/playbook/pb_passphrase/docs/_passphrase_confirmation.html.erb
playbook_ui-14.12.0.pre.rc.8 app/pb_kits/playbook/pb_passphrase/docs/_passphrase_confirmation.html.erb
playbook_ui_docs-14.12.0.pre.rc.7 app/pb_kits/playbook/pb_passphrase/docs/_passphrase_confirmation.html.erb
playbook_ui-14.12.0.pre.rc.7 app/pb_kits/playbook/pb_passphrase/docs/_passphrase_confirmation.html.erb