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



Sep 4, 2012, 1:06 AM
21 Posts

InsertText equivalent?

  • Category: Server Side JavaScript
  • Platform: Windows
  • Release: 8.5.3
  • Role: Developer
  • Tags:
  • Replies: 5
 I'm trying to replicate a function I created in the Notes UI.  I have a button that does a "gotToField" then does an "insertText" to prefix text into a RichText field.  
 
Any thoughts? 
 
thanks 
clem 
Sep 4, 2012, 3:04 AM
366 Posts
Re: InsertText equivalent?
 You can create a button with an onclick event that uses client side javascript to place focus on the field and then add the text to the field by setting it's value.
 
 
Sep 4, 2012, 6:27 AM
25 Posts
Re: InsertText equivalent?
Hey, you can do it using java script like field name.focus(), where field name comes from the document.forms[0], and the name comes from the HTML tag for that field.
Sep 4, 2012, 6:32 PM
21 Posts
Re: InsertText equivalent? .. still can't get it to work
 Guys
 
  Thanks for the replies.  I did some digging and testing and I came up with the following but it doesn't seem to work 
 
var woID = "view:_id1:waitingOn1";
document.getElementById(woID).focus;
 
I even found a bit of code but just can't get it to work. 
 
Any ideas? 
thanks 
clem 
Sep 4, 2012, 7:40 PM
366 Posts
Re: InsertText equivalent?
 Here is the source code for a complete working example.  create a new xpage and in the source view replace the starter code with the code below.  save and test in browser.
 

<?xml version="1.0" encoding="UTF-8"?>

<xp:view

xmlns:xp="http://www.ibm.com/xsp/core">


<xp:button

value="Focus on field and add text"

id="button1">

<xp:eventHandler

event="onclick"

submit="false">

<xp:this.script><![CDATA[var ipt = dojo.byId("#{id:inputText1}");

ipt.focus();

ipt.value = "Paul T. Calhoun";


]]></xp:this.script>

</xp:eventHandler>

</xp:button>

<xp:br></xp:br>

<xp:br></xp:br>

<xp:inputText

id="inputText1"></xp:inputText>

</xp:view> 
Sep 5, 2012, 6:20 PM
21 Posts
Re: InsertText equivalent?
  Hi Paul
 
 Thanks!   I couldn't get it to work initially b/c I'm trying to prepend text to a RichText field.  When I change it so that I'm updating a text field, your code worked great. 
 
 I looked back at my LotusScript code found that I'm doing an InsertText which is a NotesUIDocument method not a NotesRichTextItem as I thought.
 
 Still hunting for method to prepend text to a RichText field.  Might have to provide a dialog where text could be entered and then in the backend update the RT field. 
 
thanks 
clem 

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