1

can i programmatically click a button?

asked 2006-10-29 12:48:26 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3985825

By: simon_massey


I have a button that does a page reload:

<button id="reload" label="Reload" onClick="String tmp=inner.src; inner.src=null; inner.src=tmp;"/>

And I have another button that calls some arbitrary zscript that does some work.
After that I want to programmatically lick the refresh button with something
like:

<button id="create-restaurant" label="Create Restaurant"
onClick="createRestaurant(name.value); reload.click()"/>

but that does not work. Is there something that I can do with the event handling classes in my arbitrary createRestaurant(...) function to do the job instead?

thanks!


delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2006-10-29 16:15:19 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3986006

By: henrichen

Events.postEvent() to put the event at the end of the ZK event queue and will be called later.

or

Events.sendEvent() to "call" directly the event handler.

See Developer's Guide and JavaAPI for details.

/henri


link publish delete flag offensive edit

answered 2006-10-29 20:10:53 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3986238

By: simon_massey

excellent! it worked as follows:

<!-- this button does some work and then sends the current ON_CLICK event to the component with the id 'reload' --> <button id="create-restaurant" label="Create Restaurant"> <attribute name="onClick"> {
// do lots of stuff
Events.sendEvent(reload, event);
}
</attribute>
</button>

<!-- this is the reload button that i wanted to call at the end of the button click that above that did a lot more work --> <button id="reload" label="Reload" onClick="String tmp=inner.src; inner.src=null; inner.src=tmp;"/>



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

RSS

Stats

Asked: 2006-10-29 12:48:26 +0800

Seen: 938 times

Last updated: Oct 29 '06

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