I've noticed that there's no "submit" button feature in WebOS Inputs like there are in normal web forms. If you have a input type="submit" in your form, pressing Enter in any form input will automatically press that button because that makes sense.
However, in WebOS there is no such functionality. Instead, I have a mixin that provides this:
var EnterableControl = {
events:{onEnterPressed:""},
published:{button:null},
keyupHandler: function(inSender, inEvent) {
if(inEvent.keyCode == 13) { // enter
console.log(inEvent);
if (this.button)
this.owner.$[this.button].clickHandler(inSender, inEvent);
if (this.onEnterPressed)
this.doEnterPressed(inEvent);
}
},
};
var enterables = ["Input","PasswordInput","BasicRichText","RichText"];
for ( var i in enterables ) {
var e = enterables[i];
enyo.kind({
name:"Enterable"+e,
kind:e,
mixins:[EnterableControl],
});
}
If you want to add Enterable support to a kind, just mixin the EnterableControl object (or add it to the enterables array).
Update 9/29/11: I've changed it to use mixins. As such, it uses another enyo post of mine that includes a patch to enyo core to enable such a mixin that has an event.