?
Solved

disable enter key

Posted on 2005-02-24
8
Medium Priority
?
296 Views
Last Modified: 2013-12-24
mm.. how do i disable the enter function in editable textfield?

i tried using the below script but, the enter key is not disabled

on keydownscript me
if the keycode = 36 then
nothing
end if
end
0
Comment
Question by:weisianz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
8 Comments
 
LVL 20

Accepted Solution

by:
MediaMacros earned 200 total points
ID: 13402988
Put this in a behavior and drop it on the field..

on keyUp me
  if the key = return then
    dontpassevent
  else
    pass
  end if
end

on keyDown me
  if the key = return then
    dontpassevent
  else
    pass
  end if
end
0
 
LVL 1

Author Comment

by:weisianz
ID: 13403228
thanks.. 1 question... how come keycode = 36 does not work while key=return works?
0
 
LVL 20

Expert Comment

by:MediaMacros
ID: 13403334
It may if its placed in the script.  You were using on keydownscript which will not register when you type in teh field.  Also note that many keyboards have 2 entere keys with different key codes. :)
0
Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

 
LVL 1

Author Comment

by:weisianz
ID: 13404101
i placed another script in the field

on keydown me
if keycode = 36 then
halt
end

when i press enter, the movie is indeed stop.

but, when i change it to

on keydown me
if keycode = 36 then
nothing
end if
end

it's like, all keys disabled... nothing appears in the txtfield... is it cause by the nothing statement?
0
 
LVL 20

Expert Comment

by:MediaMacros
ID: 13404269
You need the else.  It needs to be told to pass to allow other keys through.
0
 
LVL 1

Author Comment

by:weisianz
ID: 13405037
oh... so, i just have to change it to the following?

on keydown me
if keycode = 36 then
nothing
else
pass
end if
end
0
 
LVL 20

Expert Comment

by:MediaMacros
ID: 13405089
Correct. :)

ALso add it for keyUp as well to be safe.  SOme keyboards register the events a bit differently.
0
 
LVL 1

Author Comment

by:weisianz
ID: 13409545
oic... ok... thanks
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Now that Expression Web 4.0 (http://www.microsoft.com/expression/products/Upgrade.aspx) is free if you buy or have the full version of Expression Web 3.0, now is the best time to  migrate from FrontPage to Expression Web (http://www.frontpage-to-exp…
Originally, this post was published on Monitis Blog, you can check it here . It goes without saying that technology has transformed society and the very nature of how we live, work, and communicate in ways that would’ve been incomprehensible 5 ye…
The purpose of this video is to demonstrate how to integrate Mailchimp with WordPress, by placing a Mailchimp signup form on a WordPress Page or Post. This will be demonstrated using a Windows 8 PC. Mailchimp will be used. Log into your Mailchi…
The purpose of this video is to demonstrate how to set up the permalinks on a WordPress Website. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Go t…
Suggested Courses
Course of the Month9 days, 15 hours left to enroll

762 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