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



Nov 2, 2011, 7:46 PM
37 Posts

use getComponent afterPageLoad

  • Category: APIs
  • Platform: All
  • Release: 8.5.3
  • Role:
  • Tags: getComponent,afterPageLoad
  • Replies: 4
I need to write into UIComponent the value after the Xpages is Load...
 
Why this code is wrong and generate runtime error on the calling of getComponent?
 
getComponent("MYIDCOMPONENT").setValue("something"); 
 
How can I set the initial value of this component from my JSS function?
 
Tnx
Nov 3, 2011, 6:23 AM
149 Posts
Re: use getComponent afterPageLoad
 
Which control are we talking about? the edit box control have a default value property.
 
 
/T
Nov 3, 2011, 6:35 AM
54 Posts
Re: use getComponent afterPageLoad
But doesn't default value affect only when the document is new?
Nov 3, 2011, 7:13 AM
37 Posts
Re: use getComponent afterPageLoad
I need to tranform all my Xpages centralizing the code SSJS into function in my script library
(this for calculate inherit value and write into InputTextBox inital Value)
 
But seem that getComponent function don't work into AfterPageLoad.
 

Have you any suggestion?
 
 
P.S. This scenario = postOpen event in classic Form programming in Notes
 
Mar 16, 2012, 9:06 AM
135 Posts
Re: use getComponent afterPageLoad
Hi,
 
I have a bit different scenario but the same problem. I'm trying to store an item value to viewScope in any onload event (I've tried them all). The idea is to check if value has changed when user saves. I've tried these:
  1. getComponent("FieldName").getValue() causes error 'getComponent()' is null
  2. datasourcename.getItemValue("FieldName") causes error [ReferenceError] ' datasourcename' not found
This is a Custom Control and I'm using 8.5.3. How do I get item value when page is loaded? 
 
EDIT: Now I realized I need to use the control ID when using getComponent. When I did that change, I don't get an error any more, it just returns null even when there is a value in the field. It is a Multiline Edit Box.
 
EDIT2: I was able to achieve what I want by getting the old value from the document in save button onclick event:
 
database.getDocumentByID(datasourcename.getNoteID()).getItemValue("FieldName")
 
EDIT3: Looks like I can get the old values simply this way: 
 
datasourcename.getDocument() 
 
Still it would be interesting to know the answer to the original question. 

thanks, 
 
- Panu 

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