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



Oct 9, 2012, 7:27 PM
24 Posts

Extension Library Dialog control and updating parent document

  • Category: Extension Library
  • Platform: Windows
  • Release: 8.5.3
  • Role: Developer
  • Tags:
  • Replies: 1
I have an XPage with a Dialog control from the Extension Library.
 
The dialog works fine -- opens, does what it needs to do, however, when I try to update the "parent" document, it does not work.
 
I have the XPage data source as Domino Document called document1.  I added this after reading:
http://stackoverflow.com/questions/10016205/when-i-save-a-document-from-an-extension-library-dialog-box-some-values-are-blan

    <xp:this.data>
    <xp:dominoDocument var="document1" formName="speakerReq"></xp:dominoDocument
    </xp:this.data>
 
On the dialog control, I have a Search button which calls a servlet and returns JSON that is parsed and built into an HTML table.  The first cell is a link which calls a function from a client side JavaScript library when it is clicked.  The function is to update the "parent" document with values from the returned JSON as well as close the dialog.

It can call the function when I test with just an alert() statement in that function, however, when I try to update the "parent" document, it does not recognize that.
 
I have tried to pass the "document1" object but once I get to the dialog, it says it does not exist, so the link is failing.

Here is the code snippet where the link is built:
    
            // Let's build the row...
            cell = document.createElement("td");
            resultLink = document.createElement("a");
            resultLink.setAttribute("class", "linkText");
            resultLink.setAttribute("href", "#");
            resultLink.setAttribute("onclick", "javascript:updateDocument(document1, '" + bpName + "', '" + bpEmail + "', '" + bpPhone + "', '" + bpTitle + "', '" + bpCountry + "', '" + bpLoc + "');");
            resultLink.appendChild(document.createTextNode(bpName));
            cell.appendChild(resultLink);
            row.appendChild(cell);
 
How do I get a handle on the document1 object on the client side so I can update those fields on the "parent" document as well as close the dialog?
 
Code:

    function updateDocument(doc, name, email, phone, job, country, location) {
   
    var thisField;
    
    // Need to update the document with the selected values...
    thisField = doc.getElementById("#{id:sr_Name1}");
    thisField.value = name;
    
    thisField = doc.getElementById("#{id:sr_Title1}");
    thisField.value = email;
    
    thisField = doc.getElementById("#{id:sr_Phone1}");
    thisField.value = phone;
    
    thisField = doc.getElementById("#{id:sr_Email1}");
    thisField.value = job;
    
    thisField = doc.getElementById("#{id:sr_Location1}");
    thisField.value = location + " - " + country;
    
    }
 
Thanks!
Oct 12, 2012, 1:13 PM
31 Posts
Re: Extension Library Dialog control and updating parent document
Hi Dan,
On your dialog, are you passing your parent datasource to your dialog via a property definition (com.ibm.xsp.model.DataSource)?

<xc:ccMyDialog parentDataSource="#{document1}"></xc:ccMyDialog>
 
If yes, then you should be able to access it via SSJS in an onclick event to pass your data back to the parent datasource & then close your dialog.
/* Get a handle to the parent datasource */
var parentDoc:NotesXspDocument = compositeData.parentDataSource;
parentDoc.isEditable() ? parentDoc.replaceItemValue(<your code here>) : null; 
var d = getComponent('partyDialogBox');
d.hide('closingBookPanel');
 
Is there any way you can rewrite your dialog so the cell uses a standard link control; then you would have access to both the CSJS & the SSJS?
Sometimes I've had to stuff values into viewScope variables, and have hidden controls bound to those viewScope variables -- then you can get a handle to the values via CSJS using XSP.getElementById("#{id:<yourHiddenControl>}"); and also via SSJS.
 
Maybe none of this is helpful, and you can't do anything like that in your particular situation.

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