I have a requirement to display the text and the value of a multiple choice list box but as soon as there are multiple selections the value displayed is the rawValue.
My code is something like this:
verifSubTaskDescID.addItem(this.editValue);
verifSubTaskDesc.addItem(this.rawValue);
When "this" which is a list box with ["a","first"],["b","second"] is set to a or b it works perfectly, displaying "a" in the ID and "first" in the Desc as follows:
a first
OR
b second
but when I select both this list looks like this:
first first
second second
Any ideas on how to preserve the letters without making the code too complex or hard to maintain??
Thanks!!!
Solved! Go to Solution.
Views
Replies
Total Likes
The JavaScript looks similar:
var r = "";
for (var i = 0; i < this.dataNode.nodes.length; i += 1) {
r += this.dataNode.nodes.item(i).value + " " + this.getDisplayItem(i) + "\n";
}
Textfield1.rawValue = r;
Views
Replies
Total Likes
Hi,
you can use a for loop to get all selected values from a choice list.
This could look like this.
This sample script goes to the exie event of the choice list.
It refers to the dataNode which holds the multiple values.
The for loop the then extracts the selected values and their associated display items.
var r = ""
for i = 0 upto $.dataNode.nodes.length - 1 do
r = Concat(r, $.dataNode.nodes.item(i).value, " ", $.getDisplayItem(i + 1) )
endfor
Textfield1 = r
Views
Replies
Total Likes
Any chance you have this in Javascript? Trying to get it to work with string.concat but not having much luck....
Thanks for the start!
Views
Replies
Total Likes
The JavaScript looks similar:
var r = "";
for (var i = 0; i < this.dataNode.nodes.length; i += 1) {
r += this.dataNode.nodes.item(i).value + " " + this.getDisplayItem(i) + "\n";
}
Textfield1.rawValue = r;
Views
Replies
Total Likes
Hi,
We also need to check if the itme in the list is selected and if yes then get the displaya nd edit value of it.
Below is the Javascript code:
///
var tot = lstLab.items.nodes.length;
for( var i = 0; i<tot;i++){
var bool = lstLab.getItemState(i);
if(bool == true){
var selectedDisplayText = lstLab.getDisplayItem(i);
var selectedEditValue = lstLab.boundItem(selectedDisplayText);
}
}
//////
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies