In my first "How do you do" xpages learning series I learned how to execute client side simple Java Script on xpages , Thanks to Tim Tripcony who shared interesting work around.

Actually I was trying to execute existing LS dashboard agent on xpage using client side Java Script to draw a chart. Lets see how I've done,

1- Created a new JavaScript script library with client side JavaScript which contains my xmlhttp module to call Lotus Script agent.

2- I've my Lotus Script agent ready which have logic to build flash charts ( Fusion Charts )

3- Created button "Draw Chart" on xpage and added JavaScript function "drawChart()" which is inside my JavaScript library.



You might notice I've selected "Server" tab instead "Client" one , Just following Tim's advice.

4- Open source of xpage and add your Client side JavaScript library reference .



To add Server side JavaScript library reference instead of ".js" use ".jss" and clientSide="false"

5- As per Tim's advice add additional tags in source,
so completed code will be ,

6- Switch to "Design" view of your xpage and notice now code is moved into "Client" tab ( though we have started with "Server" tab )


Here is my desire output on the web when button is clicked ,


Few days ago I was working on "Flex builder" and it's interesting to see xpages development is very similar to flex development. Those who knows either of these can accelerate really fast.

6 Responses to "XPages : How do you do ? ( Part 2)"

  1. gravatar quintessens Says:

    how does that LS agent of yours look like?

    could you send me the code?

  2. gravatar Tim Tripcony Says:

    Just to clarify, you should still enter the code initially as a Client script, the key is adding the missing tags into the Source afterwards in order to allow it to run on an 8.5.0 server. If at all possible, I'd recommend just upgrading the server - not only to avoid having to do the extra pasting every time, but also to gain all the additional performance and stability benefits.

  3. gravatar Rishi Says:

    Thanks Tim !

    However I feel there should be a hot fix which can fix such minor issues. If company just upgraded to 8.5 then how do they think to upgrade 8.5.1 again.

  4. gravatar miladawley Says:

    cool BLOG..................................................

  5. gravatar Esaiamudu Says:

    Hi ,

    I am having trouble in executing server javascript in my 8.5.0 server.Even an alert() doesn't seems to be appearing.


    Here is my error


    Unexpected runtime error
    The runtime has encountered an unexpected error.
    Error source
    Page Name:/Debug-Error.xsp
    Control Id: link1
    Property: onclick

    Exception
    Error while executing JavaScript action expression
    Script interpreter error, line=1, col=1: Reference error: 'alert' not found

    Javascript code

    1: alert("Hi");

  6. gravatar JanuskieZ Says:

    Hi... Looking ways to market your blog? try this: http://bit.ly/instantvisitors

Leave a Reply

preload preload preload