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



May 9, 2013, 11:54 AM
24 Posts

Scripting text boxes and buttons

  • Category: Dojo and Client Side JavaScript
  • Platform: Windows
  • Release: 9.0
  • Role: Developer
  • Tags: scripting
  • Replies: 3
 Hi all,

           Trying to get input from a text box and display it when a button is clicked. How to script this kind of actions? 

Also, how to use java codes in xpages? like jdbc. Need similar ideas. Please help...
May 9, 2013, 1:30 PM
110 Posts
Re: Scripting text boxes and buttons
For question 1, create a new xpage and replace the source with below:

<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core"
    xmlns:xe="http://www.ibm.com/xsp/coreex">
   
   
   
   
   
    <xp:table>
        <xp:tr>
            <xp:td>
                <xp:label value="Enter here: " id="label4"></xp:label>
                <xp:inputText id="inputText1"></xp:inputText></xp:td>
            <xp:td>
                <xp:table>
                    <xp:tr>
                        <xp:td>
                            <xp:button value="Display in alert box"
                                id="button1">
                                <xp:eventHandler event="onclick"
                                    submit="false">
                                    <xp:this.script><![CDATA[alert(XSP.getElementById("#{id:inputText1}").value)]]></xp:this.script>
                                </xp:eventHandler>
                            </xp:button></xp:td>
                        <xp:td></xp:td>
                    </xp:tr>
                    <xp:tr>
                        <xp:td>
                            <xp:button value="Display in other control"
                                id="button2">
                                <xp:eventHandler event="onclick"
                                    submit="false">
                                    <xp:this.script><![CDATA[XSP.getElementById("view:_id1:label1").innerHTML = XSP.getElementById("#{id:inputText1}").value;
XSP.getElementById("view:_id1:computedField1").innerHTML = XSP.getElementById("#{id:inputText1}").value;]]></xp:this.script>
                                </xp:eventHandler>
                            </xp:button></xp:td>
                        <xp:td>
                            <xp:table>
                                <xp:tr>
                                    <xp:td>
                                        <xp:label value="Label:"
                                            id="label2">
                                        </xp:label></xp:td>
                                    <xp:td>
                                        <xp:label value="Label"
                                            id="label1">
                                        </xp:label></xp:td>
                                </xp:tr>
                                <xp:tr>
                                    <xp:td>
                                        <xp:label id="label3" value="Computed Field:">
                                        </xp:label></xp:td>
                                    <xp:td>
                                        <xp:text escape="true"
                                            id="computedField1">
                                        </xp:text></xp:td>
                                </xp:tr>
                            </xp:table></xp:td>
                    </xp:tr>
                </xp:table></xp:td>
           
        </xp:tr>
    </xp:table></xp:view>



For question 2, you can refer here.  
 
May 10, 2013, 5:57 AM
24 Posts
Re: Scripting text boxes and buttons
 Hi Baxter ,

 
1.  What if i need to write java code to a button? for eg: if i need to add this piece of code (Process p = Runtime.getRuntime().exec(commandline);) to the onclick event of a button Is that possible in xpages? How to ?

 
 2.  How to position the individual elements (buttons, labels, etc.) in positions other than (topleft, center right, etc)  in an xpage ?

 
 3. I don't know xsp. where could i learn? Pls provide any link. 


Thanks in advance.
May 10, 2013, 12:30 PM
366 Posts
Re: Scripting text boxes and buttons
 1.  You instantiate Java Code from a SSJS button like the following

//Import packages

importPackage(com.nnsu.util.fop);

//Create a new instance of the Java class

var jce: DominoXMLFO2PDF = new DominoXMLFO2PDF();

//Call the method of the java class

var retOutput = jce.getPDF(pageOutput);



2.  You use CSS for absolute positioning of any item on a page, not just buttons. 

3.  There are lots of options.  TLCC (www.tlcc.com) has on-line eduction including a free getting started course.  XPages 101.  There are the Mastering XPages books (three now) , There are the Notes in 9 Videos with over 80 hours of content. Plus many bloggers, who contribute content every day. 


 

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