Reputation: 2616
I'm displaying a standard <form>
with a few <input>
fields in a web view.
When editing the first input field and pressing the enter key on the soft keyboard, the form is posted insted of focusing the next input field in the form.
How can I stop the form from being posted and instead put focus on the next input field?
Edit: Problem solved by adding a piece of javascript to the page;
<body onkeypress='return event.keyCode!=13; '>
Upvotes: 1
Views: 1981
Reputation: 4700
If you're trying to wire up an "OnClick" event in your Java file - I don't think it's possible. The "WebView" control just displays CSS/HTML/JS (i.e. web pages).
You should be able to use a javascript snippet to accomplish this though. Something along these lines:
<html>
<body onkeydown='if (event.keyCode==13) {event.keyCode=9; return event.keyCode }'>
...
</body>
</html>
Upvotes: 1