-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi, im having one problem, when I change my textbox to multiline shes dont trigger onOK.
Someone know one solution or workaround?
Hey guys, I solved my problem spending a lot of time, now look this solution:
<textbox id="field" multiline="true" width="100%" height="35px" type="text" xmlns:w="client">
<custom-attributes org.zkoss.zk.ui.updateByClient="true"/>
<attribute w:name="onKeyDown"><![CDATA[
if(event.shiftKey != true && event.keyCode == 13 ){
var field = jq(this);
var fieldZK = zk.Widget.$(this);
fieldZK.smartUpdate('value', field.val());
var event = new zk.Event(zk.Widget.$(this), 'onOk', {toServer:true})
zAu.send(event);
zAu.sendNow(event.target);
}
]]></attribute>
</textbox>
first I get the client field by javascript and server field, second I updated the server stat of field with the client value and created a event onOk. after create the event I sended to queue of zAu to send in next contact to server (more or less 1 second), in my case its a chat and I need to send now, so I called zAu.sendNow to force the server call.
Sorry, my english is poor but the solution is Ok!
I am using ZK 6.5.6 and got a Javascript runtime failure on above script.
After the following modification it works:
var event = new zk.Event(zk.Widget.$(this), 'onOK', {toServer:true})
zAu.send(event);
zAu.sendNow(event.target.desktop);
zAu.sendNow needs Desktop, not Widget object. Please refer to: http://www.zkoss.org/javadoc/latest/jsdoc/global/zAu.html#sendNow(zk.Desktop)
Regards, JR
Asked: 2013-01-03 17:57:05 +0800
Seen: 71 times
Last updated: Jun 18 '14