1

Event KeyPress Textbox

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

meilynlgg gravatar image meilynlgg
43 1 1 2

Hi!!

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

Thank's.

PD: Sorry but my english is so bad.

delete flag offensive retag edit

4 Replies

Sort by ยป oldest newest

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

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

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

I'm not sure . But i found this:

public void onOk$textboxId(){
     System.out.println(textboxId.getValue())
}

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
forum_10652.zul:

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


Composer_10652.java
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
30

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

link publish delete flag offensive edit

answered 2019-12-03 21:48:50 +0800

KAR11 gravatar image KAR11
1

@Listen("onOK=#input") public void onOK(Event event) {

    result.appendChild(new Label("ENTER key is pressed"));
}
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

Follow

RSS

Stats

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

Seen: 6,107 times

Last updated: Dec 03

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