I have a small application that normally has a single visible text input, and pressing enter triggers a JavaScript method without triggering the normal form submission. Here is a very simple test case:
<form onsubmit="document.write('form submitted!');return false">
<input type="text">
<input type="submit" style="display:none">
</form>
On desktop browsers this works as expected - you enter text, press enter, and the script executes.
However, on Opera Mobile focussing on the text input brings up a virtual keyboard; if you enter text and touch "Done", the text is transferred to the input field, but the form is not submitted. There is also no "enter"
I'd like the app to behave the same way across browsers and devices, rather than make the submit button visible only in Opera Mobile.
you have to:
submit()
method in thedone
event.Regarding to the event, I found out some informations:
Opera developers website:
http://www.opera.com/docs/specs/presto2.11/dom2/events/
w3c:
http://www.w3.org/TR/DOM-Level-3-Events/
Basically it doesn't say anything about specific touch events, unlike under webkit technologies. So, you will have to catch the keypress/up/down, parse the keyCode/which attribute, compare to the one of "DONE" (some alerts will give you the good one) and then call the
form.submit();
method.rgds.