• Server Side Script Dropdown Menu working on load

    By Chintan Parekh 1 decade ago

    Hi,

    I have a drop down menu on my page which includes a button to delete the page. The problem I am facing is that "onclick server side script" get executed on page load rather then "on click". Here is my code for that leaf node:

     

     

     
    
    <xe:basicLeafNode label="Read"
    
    image="/act_empty.gif">
    
    <xe:this.onClick><![CDATA[#{javascript:if(context.getUrlParameter("link"))
    
    {
    
    var doc:NotesDocument =database.getDocumentByUNID(context.getUrlParameter("link"));
    
    doc.remove(true);
    
    sessionScope.closeCheck="yes";
    
    }}]]></xe:this.onClick>
    
    <xe:this.rendered><![CDATA[#{javascript:if(context.getUrlParameter("link")!=null || context.getUrlParameter("link")!="")
    
    return true;
    
    else
    
    return false;}]]></xe:this.rendered>
    
    </xe:basicLeafNode>
    

    Thank you in advance for the reply.

    -CHINTAN

     

    • OnClick is client side

      By Philippe Riand 1 decade ago

      So your formula is executed when the page is rendered, and not onclick.

      To executed SSJS, you should set the submitValue property and handle the onItemClick event, at the control level. Look at the demo DB for a good example on how to use this.

      • Where do I find the demo db?

        By Chintan Parekh 1 decade ago

        I found some trick to do it that time..But now I really need to work on it..

        Can you suggest me some examples? or a link to demo db?

        Looking forward to your reply..

        • The demo db is part of the package on OpenNTF

          By Philippe Riand 1 decade ago

          The name is XPagesext.nsf.

          Note that this is not in the UP1 package, because we cannot release it as a supported DB as of now.

          • Thank you

            By Chintan Parekh 1 decade ago

            Ok, Thank you so much..I see it now..!