This forum is closed to new posts and responses. New discussions are now taking place in the IBM Developer Answers forum.



Jul 26, 2011, 8:07 AM
272 Posts

Re: Button running server script followed by client script - is this possible?

  • Category: Server Side JavaScript
  • Platform: All
  • Release: 8.5.2
  • Role: Developer
  • Tags: SSJS,Button,javascript
  • Replies: 3
You can do this by using the "onComplete" event. Your returning value can be computed in a script block (which has to be inside a div otherwise you can not refresh the script).
 
Here is an example:
 
    <xp:button value="Label" id="button2">
        <xp:eventHandler event="onclick" submit="true"
            refreshMode="partial" refreshId="refreshMe">
            <xp:this.onComplete><![CDATA[alert(test)]]></xp:this.onComplete>
        </xp:eventHandler>
    </xp:button>

    <xp:div id="refreshMe">
        <xp:scriptBlock id="scriptBlock1">
            <xp:this.value><![CDATA[#{javascript:"var test='" + java.lang.System.currentTimeMillis() + "'";}]]></xp:this.value>
        </xp:scriptBlock>
    </xp:div>
 
 
Sven
 

This forum is closed to new posts and responses. New discussions are now taking place in the IBM Developer Answers forum.