• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 298
  • Last Modified:

disable enter key

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
weisianz
Asked:
weisianz
  • 4
  • 4
1 Solution
 
MediaMacrosCommented:
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
 
weisianzAuthor Commented:
thanks.. 1 question... how come keycode = 36 does not work while key=return works?
0
 
MediaMacrosCommented:
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
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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.

 
weisianzAuthor Commented:
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
 
MediaMacrosCommented:
You need the else.  It needs to be told to pass to allow other keys through.
0
 
weisianzAuthor Commented:
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
 
MediaMacrosCommented:
Correct. :)

ALso add it for keyUp as well to be safe.  SOme keyboards register the events a bit differently.
0
 
weisianzAuthor Commented:
oic... ok... thanks
0

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now