Welcome to WebmasterWorld Guest from

Forum Moderators: incrediBILL

Message Too Old, No Replies

firefox 3.6.3 problem with submit form in Firefox

onkeypress, keycode, submitform, Firefox



7:51 pm on Jan 13, 2011 (gmt 0)

The following code works in Explorer and Safari but not in Firefox. Help? (Users want to be able to submit on carriage-return [enter])

<form name="myform" method="post" action="submit" >

<label><span class="bodyText">Enter your User ID:</span>
<input type="text" name="userid" id="userid" onkeypress="{if (event.keyCode==13)SubmitForm(myform)}" />

<script language="JavaScript" type="text/javascript">

function SubmitForm(form)

form.action = "../Clients/" + myform.userid.value + ".html";

form.submit(); // Submit the page
return true;



8:22 pm on Jan 13, 2011 (gmt 0)

WebmasterWorld Senior Member fotiman is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

Welcome to WebmasterWorld!
You should have a submit button. That will do two things:
1. It will allow users that don't have JavaScript enabled to submit your form
2. When a form has a submit button, the first one in the form is what will trigger when you press the enter key.


9:49 pm on Jan 13, 2011 (gmt 0)

I've tried that. I feel like I've tried everything (including window.location) but can't get all 3 browsers to go to page whose filename is input via form (usually the enter key caused page reload). At least this version works in 2 of the 3.

Featured Threads

Hot Threads This Week

Hot Threads This Month