0

Multiline textbox and onOK

asked 2013-01-03 17:57:05 +0800

roxricardo gravatar image roxricardo
31 1

Hi, im having one problem, when I change my textbox to multiline shes dont trigger onOK.
Someone know one solution or workaround?

delete flag offensive retag edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2013-02-28 20:06:03 +0800

roxricardo gravatar image roxricardo
31 1

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!

link publish delete flag offensive edit
0

answered 2014-06-18 13:55:42 +0800

juminrubin gravatar image juminrubin
36

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

link publish delete flag offensive edit
Your answer
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: 2013-01-03 17:57:05 +0800

Seen: 70 times

Last updated: Jun 18 '14

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