Wrox Programmer Forums
|
HTML Code Clinic Do you have some HTML code you'd like to share and get suggestions from others for tweaking or improving it? This discussion is the place.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the HTML Code Clinic section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 26th, 2005, 05:57 PM
Registered User
 
Join Date: May 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Submit button question

We use a form at our business that folks fill out to provide us with critical information. The info is sent via email to us but we are finding that people are hitting the "Enter" key thinking it will move them to the next field in the form. This of course actually submits the form instead. Is there someway to "de-select" the submit button so it forces them to have to click it in order to send us the form?

Thanks!
 
Old May 27th, 2005, 04:39 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

well that's the default behaviour of a submit button, and I don't know any way to turn it off. You could instead use a regular button and some javascript to do the form submission
<button type="button" onclick="document.formname.submit();">Submit</button>

but then you have to consider that if any users have JS turned off, or they don't have a JS-enabled browser, then they won't be able to submit the info to you at all.

Can't you just handle the premature submissions by server-side validation?

hth
Phil
 
Old May 27th, 2005, 01:38 PM
Registered User
 
Join Date: May 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well I think I found a solution. I just used the following code with each text box:

onKeyDown="if(event.keyCode==13) event.keyCode=9;"

Seems to be doing the trick...





Similar Threads
Thread Thread Starter Forum Replies Last Post
Make a image button as default submit button toshi ASP.NET 1.0 and 1.1 Basics 1 June 1st, 2006 05:25 AM
Submit Button trusslady Infopath 2 January 6th, 2006 05:19 PM
submit-button grstad Javascript How-To 1 May 25th, 2005 08:33 AM
Submit Button Night_Zero Classic ASP Databases 1 August 17th, 2004 04:55 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.