views:

286

answers:

1

I am working with C# and Windows Mobile.

I want to make a LeftSoftKey press trigger the "submit" action on a web page currently viewed in a WebBrowser window. In the HTML form being viewed there is a single form with an entry.

Currently I can capture the left soft key keydown event. What I can not find is how to either invoke, or trigger the WebBrowser to act as though either the submit button was pressed, or alternately the "enter" key was pressed causing the default submission. Either is an acceptable action.

A: 

You'll need to write some javascript for the webpage on that listens to the key-press and then submits the FORM programatically. The easiest way to do that would be to use an existing javascript framework like jquery.

The raw javascript code (without jquery) would be something like this:

document.onkeyup = handleKeyPress; function handleKeyPress() { switch (event.keyCode) { case 25: // some number corresponding to your desired key // do something; } }
ewoo