I have a simple form that I need to submit automatically when text is entered.
I can use the onChange or onKeyUp without the best result.
HTML is:
This is a bad idea. You don't want to circumvent the controls people expect on form inputs. If you don't want a submit button then at least wait to submit until you capture an "enter".
Other than a user mind reading device how could you ever know when a user is done typing, unless you were looking for them to type "return" or "enter"? Users won't know they're supposed to pause a moment to let the form submit at the timeout, or that they need to hurry up to get their search entered before the timeout of 500MS.
See: this question
Of if you want to start returning results immediately upon any submission you could do some kind of ajax autocomplete.
autocomplete http://img9.imageshack.us/img9/5526/autocompletegoogle.png
Here's a jQuery example of submitting on an enter:
$("input").keypress(function(e) {
switch (e.keyCode) {
case 13:
$("#formid").submit();
return false;
default:
return true;
}
});