Event KeyPress Textbox

asked 2009-12-15 14:52:18 +0800

meilynlgg gravatar image meilynlgg
43 1 1 2


Can you help me about how to do the event key press (specify enter key) in a textbox.


PD: Sorry but my english is so bad.

delete flag offensive retag edit

3 Replies

Sort by ยป oldest newest

answered 2009-12-15 16:07:13 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16

updated 2009-12-15 16:09:06 +0800

I'm not sure . But i found this:

public void onOk$textboxId(){

link publish delete flag offensive edit

answered 2009-12-30 22:11:58 +0800

PeterKuo gravatar image PeterKuo
481 2

I found it should be onOK$textboxId, the "K" should be upper case.

My sample code as follow

<window border="normal" apply="post.Composer_10652" id="win" >
<textbox id="textbox1"/>
<textbox id="textbox2"/>
<button id="test" label="tt"/>

package post;

import org.zkoss.zk.ui.util.GenericForwardComposer;
import org.zkoss.zul.Button;
import org.zkoss.zul.Textbox;
import org.zkoss.zul.Window;

public class Composer_10652 extends GenericForwardComposer {
private Window win;
private Textbox textbox1;
private Textbox textbox2;
private Button test;

public void onClick$test(){
System.out.println("button pressed");

public void onOK$win(){
System.out.println("enter pressed in window");

public void onOK$textbox1(){
System.out.println("enter pressed in textbox1");

public void onOK$textbox2(){
System.out.println("enter pressed in textbox2");

link publish delete flag offensive edit

answered 2011-12-23 01:33:05 +0800

cohay gravatar image cohay

<textbox id="IDtextBox"/>
		$('#IDtextBox').zul('keypress() is triggered!, keyCode = ' 
	              + event.keyCode + ' which = ' + event.which)

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools




Asked: 2009-12-15 14:52:18 +0800

Seen: 6,101 times

Last updated: Dec 23 '11

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More