Feedback on: irt.org FAQ Knowledge Base Q471
Worth:
Worth reading
Length:
Too short
Technical:
Not technical enough
Comments:
Any suggestions on what to do when the field hasn't changed?
Comments:
Your first statement appears not to be true! After changing a value and pressing enter the onChange event is not fired. At least not on my browser (IE5)
Length:
Too short
Technical:
Not technical enough
Comments:
The answer to the following ...
Q471 How can I simulate the tab key when the enter key is pressed?
... does not work.
Using onChange, and/or onBlur does not work in MSIE 5.~ These events do not trigger from the Enter key. I got as far as trapping the last key pressed and hope to compare it with the ASCII value of the Enter key (and or Return key). Of course if anyone has already donethis or there is a better solution, please don't hesitate to let me know.
Worth:
Worth reading
Length:
Too short
Technical:
Not technical enough
Comments:
The example does not work. I do have an alternative solution using the onsubmit event, which will tab through all fields until the visible submit button is reached and then submits the form from that button. The actual submit button is styled to have dimensions of 1x1, at least partially hiding it from the user. Not the most elegant answer, but it works :) :
<html>
<head>
<script>
var focusControl;
function doFocusChange() {
focusControl.focus();
return false;
}
function nextFocus(control) {
focusControl = control;
}
</script>
</head>
<body>
<form name="myForm" method="post" action="testForm.html" onSubmit="return doFocusChange()">
<input type="text" name="text1" onFocus="nextFocus(document.myForm.text2)">
<input type="text" name="text2" onFocus="nextFocus(document.myForm.text3)">
<input type="text" name="text3" onFocus="nextFocus(document.myForm.Submit)">
<input type="submit" width="1" style="width: 1; height: 1;">
<input type="button" name="Submit" value="Submit" onClick="submit()">
</form>
</body>