Disabling "Enter" key throughout a web page

M

Mark

I have seen scripts that will allow me to disable
the "enter" key inside of text boxes in a form, but the
ones that I have seen require including a script in each
box. Is there a way to simply disable the "enter" key for
the entire form, so that the only way to submit the form
is actually to use the mouse and press on the "submit"
button?

Thanks!

mark
 
J

Jack Brewster

Mark,

What you need to do is assign a check on the submit event. Here's a sample
that does this. Notice that none of the fields have JavaScript explicitly
associated with them:
http://javascript.internet.com/forms/required-fields.html

Here's another one:
http://javascript.internet.com/forms/return-key-disable.html

A FrontPage specific one:
http://javascript.internet.com/forms/submit-once-for-frontpage.html

A couple validation script:. You'll probably find it's similar to the
scripts above:
http://javascript.internet.com/forms/validation.html

All these scripts were found here. There may be others that will interest
you:
http://javascript.internet.com/forms/

I can't vouch for any of these as I haven't used them, but they should at
least put you in the ballpark. Also, make sure that you aren't relying on
only a JavaScript solution for form validation. You should still validate
on the server side because, if a visitor has disabled JavaScript in their
browser, none of these scripts will work and you will still get empty
fields.

Good luck!
 
T

Tom Pepper Willett

Wouldn't it be simpler to use the FP validation?
--
-----
Tom Pepper Willett
Microsoft MVP - FrontPage
http://www.microsoft.com/office/frontpage/prodinfo/default.mspx
To find the best Newsgroup for FrontPage support see:
http://www.net-sites.com/sitebuilder/newsgroups.asp
----
| Mark,
|
| What you need to do is assign a check on the submit event. Here's a
sample
| that does this. Notice that none of the fields have JavaScript explicitly
| associated with them:
| http://javascript.internet.com/forms/required-fields.html
|
| Here's another one:
| http://javascript.internet.com/forms/return-key-disable.html
|
| A FrontPage specific one:
| http://javascript.internet.com/forms/submit-once-for-frontpage.html
|
| A couple validation script:. You'll probably find it's similar to the
| scripts above:
| http://javascript.internet.com/forms/validation.html
|
| All these scripts were found here. There may be others that will interest
| you:
| http://javascript.internet.com/forms/
|
| I can't vouch for any of these as I haven't used them, but they should at
| least put you in the ballpark. Also, make sure that you aren't relying on
| only a JavaScript solution for form validation. You should still validate
| on the server side because, if a visitor has disabled JavaScript in their
| browser, none of these scripts will work and you will still get empty
| fields.
|
| Good luck!
|
| --
| Jack Brewster - Microsoft FrontPage MVP
|
| | > I have seen scripts that will allow me to disable
| > the "enter" key inside of text boxes in a form, but the
| > ones that I have seen require including a script in each
| > box. Is there a way to simply disable the "enter" key for
| > the entire form, so that the only way to submit the form
| > is actually to use the mouse and press on the "submit"
| > button?
| >
| > Thanks!
| >
| > mark
|
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top