0

call 2 functions in Onclick of a button, in which one is javascript

asked 2009-03-25 17:29:25 +0800

vaishali gravatar image vaishali
78 1

<button id="btnPrnPrint" label="Print!" width="75px" action="onclick:test('2nd')"/>

<script type="text/JavaScript">
<![CDATA[
function test(tbxsss) {
alert(tbxss)
}
]]>
</script>

How can I call 2 methods and the priority is first call :

1 )contractEditor.btnPrnPrintOnClick(); which will set the value of the label
2) onclick:onCall(lbl.value) -- javascript fucntion...

Please tell me how can I do that I tried below possiblities :
1)action="onclick:contractEditor.btnPrnPrintOnClick();test('2nd');"/> -- doesn't call btnPrnPrintOnClick()
2)action="onclick:contractEditor.btnPrnPrintOnClick(),test('2nd');"/> -- doesn't call btnPrnPrintOnClick()
3)OnClick="contractEditor.btnPrnPrintOnClick()" action="onclick:test('2nd')" -- Both are called at the same time..
4) OnClick="contractEditor.btnPrnPrintOnClick(),test('2nd');"

Either the above way onclick or anyotherway where I can have "contractEditor.btnPrnPrintOnClick() be called first when the window is loaded and then on that button click I can have the action to call that javascript..

Please help

delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2009-03-25 18:24:35 +0800

vaishali gravatar image vaishali
78 1

I found a way but still stuck..
<label id="lblUrl" visible="false"/>

<button id="btnPrnPrint" label="Print!" width="75px" onClick='contractEditor.btnPrnPrintOnClick();alert(lblUrl.value);Clients.evalJavaScript("test(lblUrl.value)")'/>

But lblUrl is not recognized when I run this page.. can anyone please help me as to how to pass the values from ZK element to the javascript's function.

link publish delete flag offensive edit

answered 2009-03-30 01:25:27 +0800

PeterKuo gravatar image PeterKuo
481 2

The key point is, you have to let server parse the value first,
and then pass the result string to client side as java script.

One possible solution is:
xxx.evalJavaScript("test(' "+label.getValue()+" ')")

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: 2009-03-25 17:29:25 +0800

Seen: 1,349 times

Last updated: Mar 30 '09

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