homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Browsers / Firefox Browser Usage and Support
Forum Library, Charter, Moderators: incrediBILL

Firefox Browser Usage and Support Forum

firefox 3.6.3 problem with submit form in Firefox
onkeypress, keycode, submitform, Firefox

Msg#: 4252989 posted 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;




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

Msg#: 4252989 posted 8:22 pm on Jan 13, 2011 (gmt 0)

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.


Msg#: 4252989 posted 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.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Browsers / Firefox Browser Usage and Support
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved