-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hai...
I am new to zkoss. My problem is to fire a onChange event for a textbox. Here my scenario is i kept that textbox in visible="false" mode and when i click one panel that label corresponding value is filling in the textbox. At that time textbox onChange event should be fired...
Please tell me how to fire a textbox onchange event wen it is in invisible mode
Thanks in advance...
Regards...
Kanth
Kanth,
Welcome to ZK. If I understand your scenario, I believe the issue is that the onChange event is fired when the textbox is modified from the UI. Because you are doing this from the server side, you must manually fire the event. Here is an example:
<zk> <zscript> import org.zkoss.zk.ui.util.GenericForwardComposer; public class myController extends GenericForwardComposer { Textbox txtbx; public void onClickLabel(Event event) { txtbx.setValue(event.getOrigin().getTarget().getValue()); Events.sendEvent(txtbx, new Event(Events.ON_CHANGE, txtbx)); //Manually fire the onChange event } public void onChangeTextbox(Event event) { alert("Textbox onChange event received - value is: " + event.getOrigin().getTarget().getValue()); } } </zscript> <window id="win" apply="myController"> <label value="XXXX" forward="onClick=onClickLabel"></label> <textbox id="txtbx" forward="onChange=onChangeTextbox" visible="false"></textbox> </window> </zk>
Hope that helps,
Todd
Asked: 2012-06-05 12:40:26 +0800
Seen: 266 times
Last updated: Jun 06 '12