Asked By: Anonymous
I have a {{view Ember.TextField action="foo"}}
nested in a <form>
tag:
My form:
<form>
{{view Ember.TextField action="foo"}}
</form>
I hoped pressing enter
in this textfield will call the action foo
, without triggering a submit
event on its form (because, by default, Ember.TextField#bubbles
is set to false
). But it is not the case: the page is reloaded.
For semantic and integration purpose, I would like to keep the <form>
tag, and do not write an Ember.Form
view.
You can test it in this JSFiddle.
How could I achieve this ?
PS: I’m using ember-latest:
- version: v1.0.0-pre.4-31-g16442c5
- last commit: 16442c5 (2013-01-23 23:48:09 -0800)
Solution
Answered By: Anonymous
<form {{ action "" on="submit" }}>
will prevent the form submission. (This is basically equivalent to the onsubmit="return false;"
suggestion in another answer.)