Thursday, 24 May 2012

Text Box on change and on Changing Event

ZK Demo site shows the example using ZUL File how to handle onChanging event. Let us see how we can handle in java using MVC  GenericForwardComposer composer

Zul File

<?page title="On Change Event" contentType="text/html;charset=UTF-8"?>
<zk>
    <window title="On Change Event" border="normal" apply="mypack.OnchangeTxt">
        <grid width="100%">
            <rows>
                <row>
                    onChanging textbox:
                    <textbox id="t1" />
                </row>
                <row>
                    Instant copy:
                    <textbox id="copy" readonly="true" />
                </row>
            </rows>
        </grid>
 
    </window>
</zk>


Controller



package mypack;
 
import org.zkoss.zk.ui.util.GenericForwardComposer;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.InputEvent;
import org.zkoss.zul.Textbox;
 
public class OnchangeTxt extends GenericForwardComposer {
 
    private Textbox copy;
 
    public void onChanging$t1(InputEvent event) {
        copy.setValue(event.getValue());
 
    }
}

2 comments:

  1. Thanks a lot, as Jhonatan says very simple and clear! in other forums there are very rustic methods to do this function!

    ReplyDelete