I have a function that sets focus to the next field through JS on the form when we press enter:
function pressEnter(obj, e) {
var key = e.keyCode ? e.keyCode : e.which;
if (key === 13) {
var total = document.forms[0].elements.length;
for (var i = 0; i < total; i++) {
if (obj.id == document.forms[0].elements[i].id) {
index = i + 1;
while ((document.forms[0].elements[index].type == "hidden" || document.forms[0].elements[index].nodeName == "FIELDSET" || document.forms[0].elements[index].disabled == true)) {
index++;
if (document.forms[0].elements[index] == null)
return;
}
$('#' + document.forms[0].elements[index].id).focus();
break;
}
}
}
}
In the BODY tag, I have the following script: onkeypress = "var key = event.keyCode? Event.keyCode: e.which; return (key! = 13);" to avoid the message when [Enter]
Act normally if I set [TextBox1 autoPostBack = false] [TextBox2 autoPostBack = false]. Type TextBox1, [enter], TextBox2 receives focus and fires the body's onkeypress event.
Good.
This is where the problem arises
[TextBox1 autoPostBack = false] [TextBox2 autoPostBack = true], textBox2 , , onkeypress .
TextBox2 . , TextBox AutoPostBack = true , onBlur.
, TAB, , JS.
- , , .
-