Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

setting up an application page-how do you restrict the enter key to be used similar to the tab key?

Posted on 2005-04-19
5
Medium Priority
?
167 Views
Last Modified: 2010-04-25
I was wondering how you would set this up, say if you had a ton of forms and you don't want people to be able to send the forms by simply pressing enter(by mistake thinking it will take them to the next form)-is this a viable question?- i'm not sure design wise if there is an elegant solution to this? what is your recomendation?
0
Comment
Question by:toddkeller
  • 4
5 Comments
 
LVL 20

Accepted Solution

by:
trailblazzyr55 earned 500 total points
ID: 13826118
Can be solved with a little javascript, this will disable the enter key... and force user to click submit

<html>
<head>
<title>The Title Of Your Page Goes Here!</title>
<script language="javascript" type="text/javascript">
<!--
function checkCR(evt) {
var evt = (evt) ? evt : ((event) ? event : null);
var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
if ((evt.keyCode == 13) && (node.type=="text")) {return false;}
}
document.onkeypress = checkCR;
//-->
</script>
</head>
<body>

<p><center><form action="" method="post">
Email Address<br><input type="text" name="field1" size="40" /><br>
Subject Matter<br><input type="text" name="field2" size="40" /><br>
Enter Your Comments<br><textarea cols="40" rows="5" name="field3" wrap="physical"></textarea><br>
<input type="submit" value="Send it!"><input type="reset" value="Clear it!">
</form></center></p>

</body>
</html>


~trail
0
 
LVL 20

Expert Comment

by:trailblazzyr55
ID: 13826169
Just a note, the javascript requires that there as at least one form type of text meaning you have to have one of these...

<input type="text" name="yourFieldName" ... >

hope that helps,
~trail
0
 
LVL 1

Author Comment

by:toddkeller
ID: 13829721
That's awesome!, thanks a lot-i've got another question for you i'll post tonight that would be super helpful to me as well, thanks again,
t
0
 
LVL 20

Expert Comment

by:trailblazzyr55
ID: 13830119
Sure, not a problem! I'd be happy to answer any questions you have :o)

Best Regards,
~trail
0
 
LVL 20

Expert Comment

by:trailblazzyr55
ID: 13830120
Thanks for the points :o)
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For those who don't know, Adobe Dreamweaver is a popular commercial web editor that enables you to design, build and manage complex websites. The editor is a WYSIWYG (What You See Is What You Get) web editor, which means that you can create your web…
Adobe Dreamweaver CS5 is a WYSIWYG web page editor that has advanced HTML, CSS, and Javascript rendering functionality and is probably the most well-known HTML editor available. Much of Dreamweaver's appeal centers around the Design View interfac…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
How can you see what you are working on when you want to see it while you to save a copy? Add a "Save As" icon to the Quick Access Toolbar, or QAT. That way, when you save a copy of a query, form, report, or other object you are modifying, you…

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question