Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Safari Refresh problem on enter/return key

Status
Not open for further replies.

abhi910

Programmer
Jul 14, 2006
9
when i hit the enter/return key on any of the text fields on my page in Safari the page refreshes. I want to prevent this from happenning. Any idea how this can be done???

The page does not refresh on enter/return key in Mozilla on Mac, Mozilla/IE on PC.
 
If the page is refreshing it means the form is being submitted. Not sure why this would only happen in safari?

To stop the form being submitted you would so something like this in your form tag:
Code:
<FORM NAME="f" onSubmit="goFunction(); return false;">

goFunction() being the code that will run when the form is submited (you can leave this out)

If your doing this already and the form is still being submitted (page refreshes) there is an error the goFunction which stops the processing of the JS and therefor the return false isn't run.

Hope thats helpful?

Ben.



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top