Wrox Programmer Forums
|
ASP Forms As of Oct 5, 2005, this forum is now locked. Please use "Classic ASP beginner" at http://p2p.wrox.com/forum.asp?FORUM_ID=54 or "Classic ASP Professional" http://p2p.wrox.com/forum.asp?FORUM_ID=56 instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Forms 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 March 12th, 2004, 02:10 PM
Registered User
 
Join Date: Jan 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default saving textarea with keyboard enter

Is there any way to 'save' a textarea by hitting enter on the keyboard (rather than just putting in a line break) instead of clicking a submit button?

Thanks

 
Old March 15th, 2004, 01:25 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

You can add javascript to the textarea's onKeyDown, onKeyPress or onKeyUp handler. This JS needs to check for the key that was pressed, using "event.keyCode". Then you can trap the enter key and call <myform>.submit() to submit the form. I don't recall off hand what the enter key code is, but you can just put in an alert() and spit out the keycodes to see what the enter key is.

Of course, the whole point of a textarea is to support multi-line text. If you are going to make the enter key act as the save action, why bother to use a textarea?

Peter
------------------------------------------------------
Work smarter, not harder.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Avoid enter data from keyboard into combobox mona_upm84 Excel VBA 1 September 5th, 2008 01:26 AM
saving data from HTML textarea Durkee VB.NET 2002/2003 Basics 4 May 9th, 2008 09:25 AM
How to disable ALT+ENTER keyboard shortcut q2q2 BOOK: Access 2003 VBA Programmer's Reference 0 November 8th, 2006 05:05 PM
Entering a password, then "enter" from keyboard? natalie09 Javascript How-To 2 April 22nd, 2004 02:56 PM
posting a textarea with a keyboard enter md0004 Javascript How-To 4 March 12th, 2004 06:01 PM





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