Sep 19, 2016, 4:46 PM
7 Posts
topic has been resolvedResolved

View Panel Checkbox column

  • Category: Server Side JavaScript
  • Platform: Windows
  • Release: 9.0.1
  • Role: Developer
  • Tags: View Panel
  • Replies: 1

I have an xpage that contains some fields and a custom control dialog box.  In the dialog box I have a view panel where the first column is set to display a check box and the next column displaying some text. It also has a multi line edit box where the user can enter more information.  What I want to happen is when the user selects a document in the view using the check box it puts the text in a viewScope variable. The user then adds additional information in the edit box and then clicks the OK button.  The OK button gets the value of the edit box and combines it to the viewScope variable and then returns the combined value to the main document and closes the dialog box.  When I use the first column as a link without the checkbox this all works.  To help the user see what they selected I wanted to use the check box.  When I use the checkbox option I get this returned in the field:

0 This is a test.  

Where I added "This is a test" in the edit box.  I get the same thing if I select multiple checkboxes.  Not sure what I'm missing here, probably something really simple.

Below is the code.

onClick of the Checkbox  - Server Options:  No Update

var viewPanel = getComponent("viewPanel1");

var docIDArray = viewPanel.getSelectedIds();

var unidArray = new Array();

var sdatabase:NotesDatabase = session.getDatabase(session.getServerName(), "Support\\Lookups.nsf")

 

if (sdatabase.isOpen()){

    for(i=0; i < docIDArray.length; i++) {

           var unid = sdatabase.getDocumentByID(docIDArray[i]).getUniversalID();

           unidArray.push(unid);

    }

    viewScope.preText = unidArray;

 

}else {

 

    viewScope.preText = "Not Open";

}

 

 

 

OK Button Code - Server Options: Partial Update  inputComments

var dialog = getComponent("dialogARExistingCondition");

var eCondition = getComponent("arExistingCondition").getValue();

var condition = viewScope.preText + " " + eCondition;

 

getComponent("inputComments").setValue(condition);

 

dialog.hide();

 

 

Sep 21, 2016, 5:13 PM
298 Posts
well...
You have:

var condition = viewScope.preText + " " + eCondition;

viewScope.preText is an array. eCondition is a String. Since the user can select more than one checkbox, what exactly do you want to do? If you want to append eCondition to each member of the array you have to loop through the array to do the concatenation. This is not Notes formula...

Also, I am not sure you can do the onClick of the checkbox... Move that code to your button that closes the dialog (to get the selected ids). For that matter if you just want the selected UNID you don't have to get the document? The getSelectedIds returns the array with the selected doc UNIDs.

Howard