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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Submit Button 2

Status
Not open for further replies.

JulieM

Programmer
Jun 6, 2001
25
GB
I've created a number of CF Forms but when I enter data I have noticed that if I press return it automatically submits the details. Is there a way to turn off this functionality.
 
Hi,

This is a possible sollution. As far as i know this only works for IE.

Put this script between the HEAD tags:

<SCRIPT TYPE=&quot;text/javascript&quot;>
<!--
function getkey(e)
{
if (window.event) { key = window.event.keyCode }
else if (e)
key = e.which
else
key = null;
if (key == 13) return false
}
//-->
</SCRIPT>

And put this in the body

<form onKeyPress=&quot;return getkey(this,event)&quot; action=&quot;somePage.html&quot; action=&quot;post&quot;>
<input type=&quot;text&quot; name=&quot;textBox1&quot; value=&quot;&quot;><br>
<input type=&quot;submit&quot; name=&quot;send&quot; value=&quot;Submit&quot;>
</form>

Hope this gets you any further!

Kristof
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top