This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Mar 17, 2011, 11:01 AM
21 Posts

Re: Trigger Button Click from SSJS

  • Category: Server Side JavaScript
  • Platform: Windows
  • Release: 8.5.2
  • Role: Developer
  • Tags: SSJS
  • Replies: 3
What is the button doing?  If it's calling a client JS function, then you could use SSJS to emit JS code to call it when the page reloads.
Here is a bit of code I use to call a clientside function using the ids calculated serverside.
Note how the input field is set escape=false to allow me to emit html into the page.
 
<script language="Javascript">
                                    XSP.addOnLoad(function () {
                                    initLocal();
                                    }
                                    );
</script>
                              <xp:text escape="false" id="elementidfield1">
                                    <xp:this.value><![CDATA[#{javascript:var out="<script language=\"Javascript\">\n";
out += "var charTextId = \"" + getClientId("charTextId") + "\";\n";
out += "var divCWidthId = \"" + getClientId("EntryDisplay") + "\";\n";
out += "function initLocal(){\n";
out += "var charElem = document.getElementById(charTextId);\n";
out += "var divCWidth = document.getElementById(divCWidthId);\n";
out += "charElem.style.fontSize = pointSizeToFit(charElem,divCWidth.offsetWidth);\n";
out += "}\n";
out += "</script>";
out}]]></xp:this.value>
                                </xp:text>
Mar 17, 2011, 12:15 PM
6 Posts
Re: Trigger Button Click from SSJS
Thanks a lot for the Reply.
 
I am trying to implement Search functionality in XPages, which will display the Search results and will keep the same sorting order as it is in the view.
The Search Results are retrieved by changing the selection formula of the a Search View. I have a Repeat Control to display the Search Results retreived as a NotesViewEntryCollection.
When the selection formula of the view is changed I am programmatically locking the view. When the view is locked by a user another user will have to wait till the view is unlocked.
 
I have put my code in  
try 
 
My code is running perfectly. But with one flaw, when I am reloading the page on Catch
 
catch(e) {
url=context.getUrl();
context.redirectToPage(url.toString());
 
The Problem is all the Search parameters enetered on the Seach Page are lost on reload. I want to perform the same activity as my "Find Now" button does.
 
<xp:button value="Find Now" id="button2"
        styleClass="button">
        <xp:eventHandler event="onclick"
         submit="true" refreshMode="complete" id="eventHandler1">
         <xp:this.script><![CDATA[window.document.getElementById("#{id:txt_Status}").value="SUBMIT";]]></xp:this.script>
        </xp:eventHandler>
</xp:button> 
 
Could you please help me how to write the equivalent code SSJS otherwise to trigger "Find Now" button Click event from SSJS.
 
Mar 18, 2011, 8:18 AM
21 Posts
Re: Trigger Button Click from SSJS
So you want to enter search parameters on one page, hit submit, and return the results on the next page?
If you bind the fields on the search parameters page to sessionScope variables, they will be available to retrieve on the following page.
 

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal