Sorry,
Maybe I wasn't clear.
I do have multiple buttons on the form.
Without the javascript the enter key ends up invoking the "sign out" button, I guess because it is the top most element that can receive focus.
I'm trying to redirect the enter key focus to my "execute search" button. The form has several different render modes so I've included that little "!=null" check to ensure that I only try to invoke the search button when it is visible.
The javascript I supplied works just fine in IE. It doesn't work in FF. Firefox's error console throws the following error: "event has no properties".
Main Topics
Browse All Topics





by: aflat362Posted on 2006-11-03 at 13:32:56ID: 17870380
what are you trying to achieve?
rn false;">
Do you have multiple buttons on your form?
Is the problem that without this script, the enter key automatically submits the form?
If you are simply trying to prevent the enter key from submitting your form change the type of the "submit" button to be of type "button"
and submit the form after the button is clicked.
<html>
<head>
<script language="javascript">
function SubmitTest() {
document.form1.submit();
}
</script>
</head>
<body>
<form name="form1"onSubmit="retu
<input type="text" name="text1">
<input type="button" name="button1" value="submit" onclick="SubmitTest()">
</form>
</body>
</html>