forward="target_event_expr"forward="oringal_event=target_event_expr"
where target_event_expr is an event expressions. An event expression is used to identify an event that is targeting a particular component. It can be one of the following formats:
event-nametarget-id.event-nameid1/id2/id3.event-name${el-expr}.event-name
It is used to forward an event, that is targeting a particular component, to another component and to another event name. It is called the forward condition.
For example, you can forward the onClick event targeting a button to the window as follows:
<window id="w" use="MyWindow"> ... <button lable="Submit" forward="onClick=w.onOK"/> </window>
Then, you can handle the submission in the MyWindow class as follows:
public class MyWindow extends Window {
public void onOK() {
//handle the submission
}
}
The original event is optional. If it is omitted, onClick is assumed. Similarly, the target ID is also optional. If omitted, the space owner is assumed. Thus, the above codes can be simplified to the following:
<window id="w" use="MyWindow"> ... <button lable="Submit" forward="onOK"/> </window>
If you want to forward several events, you can specify these conditions in the forward attribute by separating them with the comma (,):
<textbox forward="onChanging=onUpdating, onChange=some.onUpdate"/>
The forward event being sent is an instance of the org.zkoss.zk.ui.event.ForwardEvent class. You can retrieve the original event by use of the getOrigin method.
forward="orginalEvent=targetId1/targetId2.targetEvent(eventData)"
You can pass the application-specific information to the forward event by surrounding it with parenthesis and appending it to the forward condition as shown above. The information can be retrieved by use of the getData method of the ForwardEvent class.
<button forward="onCancel(abort)"/>
The getData method will return "abort". Of course, you can specify EL expressions to pass whatever type of data you want.
forward="originalEvent=${el-targetPath}.targetEvent(${el-eventData})"
You can use EL expressions when specifying the target ID/path and the application-specific information (aka., the event data).
<button forward='${mainWnd}.onOK(${c:getProperty("status")})'/>
However, you can not use EL expressions to specify the event names.