0

How can I set a Textbox value using a javascript call

asked 2011-03-30 17:08:28 +0800

dartcwb gravatar image dartcwb
9 1

I have an app using zk and at some point I call a javascript that shows an outer div containing a search panel

(Clients.evalJavaScript("showMySearchDIV()");).

I want the DIV'S javascript event onclick() to set the value of the zk textbox. This search panel is located at another div and it is pure html/javascript.

thanks.

delete flag offensive retag edit

11 Replies

Sort by ยป oldest newest

answered 2018-11-19 11:12:45 +0800

cor3000 gravatar image cor3000
6280 2 7

I am a bit surprised by the question. The previous example already showed a server side listener using zscript which is helps to create more compact examples

<textbox id="txtBxId" value="" 
    onChange="Clients.showNotification(event.getValue());"/>

The same listener can be registered in a Composer class: http://zkfiddle.org/sample/28or1m7/4-set-textbox-value-from-client

public void onChange$txtBxId(InputEvent event) {
    Clients.showNotification(event.getValue());
}

or in a SelectorComposer

@Listen("onChange=#txtBxId")
public void onMyInputChanged(InputEvent event) {
    Clients.showNotification(event.getValue());
}

I assume you see the pattern, all of the above are executed in the server side JVM. I wonder how the rest of your application is implemented, if the above information doesn't help, please let me know.

link publish delete flag offensive edit
Your reply
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
2 followers

RSS

Stats

Asked: 2011-03-30 17:08:28 +0800

Seen: 1,234 times

Last updated: Nov 19 '18

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