0

ZK 5.0.11 After setting value on a widget via 'w:onClick', how does one make the widget to send its value to the component, so that it can be used in a composer?

asked 2014-09-22 08:50:32 +0800

abcd123 gravatar image abcd123
17 3

Hello,

I have w:onClick on a button which executes a custom javascript and sets value of a different widget:

i.e. this.$f('is123').setValue( javascript_computation );

After the javascript finishes and I inspect the value of 'id123' in a composer, the value is unchanged.

In version 3.6.5, I used comm.sendEvent, however that is unavailable in version 5.

Thanks for your help.

delete flag offensive retag edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2014-09-28 12:21:12 +0800

Darksu gravatar image Darksu
1991 1 4

Hello abcd123,

The solution to your problem is that you have to fire an event to the widget. For more information please look at the following url's:

http://books.zkoss.org/wiki/ZKClient-sideReference/Communication/AURequests/Client-sideFiring

http://ben-bai.blogspot.gr/2013/06/zk-cdt-fire-event-to-server-to-create.html

Best Regards,

Darksu

link publish delete flag offensive edit
0

answered 2016-12-07 16:41:27 +0800

WilliamB gravatar image WilliamB
1609 1 6

updated 2016-12-07 16:44:32 +0800

How one would do that when changing a label value ? I added an event listener on the widget for a textarea in a custom component

textArea.setWidgetListener(Events.ON_CHANGING, "this.nextSibling.firstChild.setValue(event.data.value.length)");

To update a label with a counter. But on the server side, the value of the counter is never updated. And I've a button which call the server and , among other things, clear the textarea of the component, and thus I want to reset the counter label to 0 but since server side it's still 0 it nevers updated the value on the front ...

The idea was to use a front side listener to avoid adding the listener on java side ... and maybe avoid calling the server on each onChanging of the textarea.

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
1 follower

RSS

Stats

Asked: 2014-09-22 08:50:32 +0800

Seen: 33 times

Last updated: Dec 07 '16

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