homepage Welcome to WebmasterWorld Guest from 54.196.57.4
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor
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
cflores59




msg:4252991
 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" >

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

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

function SubmitForm(form)
{

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

form.submit(); // Submit the page
return true;
}
</script>

</form>

 

Fotiman




msg:4252999
 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.

cflores59




msg:4253046
 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.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved