Skip to content
This repository has been archived by the owner on Jun 18, 2020. It is now read-only.

Trouble with event handlers on forms #9

Open
gbdrummer opened this issue Jul 27, 2019 · 0 comments
Open

Trouble with event handlers on forms #9

gbdrummer opened this issue Jul 27, 2019 · 0 comments

Comments

@gbdrummer
Copy link
Member

Take the following basic code

<div class="reg">
  <form id="form">
    ...
  </form>
</div>
const MyReg = new NGNX.VIEW.Registy({
  selector: '.reg',
  namespace: 'reg.',

  events: {
    initialized () {
      MyReg.ref.form.on('submit', evt => {
        console.log('Firing submit handler')
        evt.preventDefault()
      })
    }
  }
})

The submit handler on the form will never fire. If you change that code to

MyReg.ref.form.element.addEventListener('submit', evt => {...})

...it works fine. on() handlers on other non-form elements appear to work fine as well, just not on form elements.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant