-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3603168
By: nobody
The event in itself is fine (you're probably using the onkeyup javascript event).
However, you should make it so, or add a support for a short delay. Right now, whenever I hit a key, a request is sent to the server. So, for example, when I'm typing really fast, multiple requests are being sent, so the text in the other box is getting typed out even after I finished typing (this would probably look worse on dial-up connections).
What you should do is not send any requests before, let's say, 500 ms passes.
So, the user types very fast, and then halts, half a second passes, and only then the request is sent. Saves the server some bandwidth, and you're also avoiding the risk of the browser breaking down.
If you need support on this I can help, since I've implemented this same thing just recently in Javascript :)
Csaba
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3603607
By: tomyeh
We actually use a timer to scan whether it is changed, once the component got focus.
Maybe the interval is too small (150ms). You might take a look at widget.js in zul.jar. I love to hear your comment.
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3603829
By: gcsaba2
Changing the timer to 500 ms seems to have did the trick. Now the event doesn't happen "immediately", but there's a noticable difference between loading all the city names starting with "a" and "ams" :)
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4103688
By: rainermichael
Hi,
I want to create a Textbox where the numbers of char are shown in another textbox that the user has entered so far. The textbox should be updated every time the usere enterd a new character in the first textbox.
I tried to rely on the onChanging event and expected that this event is fired every time the user enters a char in the textbox. But this didn't happend. The onCanging event behave like the onChange Event. Only if the user leaves the component (onBlur) the Event is fired.
<x:row><x:label zk:value="${pindex.polltext}"/><x:vbox><span class="smallfont">Max.
255 Zeichen</span><x:textbox zk:onChange="onChanging()" zk:id="quest" zk:rows="5"
zk:cols="40" zk:maxlength="255"></x:textbox><x:textbox zk:id="chars"
zk:disabled="true" zk:cols="4"/></x:vbox></x:row> <zk:zscript> void onChanging(){ String text = (String) quest.getValue(); int len = text.length(); chars.setValue(len+"");
}
</zk:zscript>
Regards
Michael
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4103712
By: rainermichael
Sorry,
I got it.
<zk:zscript>
void onChanging(){
String text = (String) event.getValue(); int len = text.length(); chars.setValue(len+"");
}
</zk:zscript>
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4103707
By: perolesen
I'm rather new to ZK so forgive me if I'm wrong...
Can it be that listening in the way you do (using onChange="..." on the element) does not produce an ASAP event/listener? You could try doing this instead:
<x:textbox zk:onChange="onChanging()" zk:id="quest" zk:rows="5" zk:cols="40"
zk:maxlength="255"></x:textbox>
<zscript>
quest.addEventListener("onChanging", new EventListener() {
public boolean isAsap() {
return true;
}
public void onEvent(Event event) {
text = quest.getValue();
len = text.length();
chars.setValue(len+"");
}
});
</zscript>
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4104985
By: henrichen
Will your code work?
<x:textbox zk:onChanging="doChanging()" ....>
/henri
Asked: 2006-02-28 22:32:01 +0800
Seen: 1,170 times
Last updated: Jan 16 '07