Raynos / value-event

Create DOM event handlers that write to listeners
MIT License
21 stars 14 forks source link

Prevent Default form submission #3

Open jxson opened 10 years ago

jxson commented 10 years ago

Right now adding a submit event doesn't do an event.preventDefault() so the page ends up reloading.

To get around it I have been passing in an array with a custom event handler. For example:

return h('form.login-form', {
  'ev-event': [
    preventDefault,
    mercury.submitEvent(state.events.login)
  ]

It seems that when the element is a form and the event type is a "submit" that the value-event/submit module should probably preventDefault() to keep the page from reloading...

Raynos commented 10 years ago

Added a possible solution to v1.3.5

Will need more testing