Hello,
I am new to LiveCycle and searched the forums for an answer as to how to populate multiple selections from a list box to a text field.
I added to the calculate field of the text field the following: TextField14.rawValue = ListBox1.rawValue
Is there a way I can modify this so that the items from the listbox populate the text field so that the values show up side by side (i.e. California, Connecticut, New York) instead of top-down?
Joe
Solved! Go to Solution.
Views
Replies
Total Likes
I would use the following JS code in the 'exit' event of the List box
var
ListValue = this.rawValue;
ListValue
= replaceAll(ListValue, "\n", " ,");
TextField1.rawValue
= ListValue;
function
replaceAll(oldStr,findStr, repStr) {
var srchNdx = 0; // srchNdx will keep track of where in the whole line// of oldStr are we searching.
var newStr = ""; // newStr will hold the altered version of oldStr.
while (oldStr.indexOf(findStr,srchNdx) != -1)
// As long as there are strings to replace, this loop
// will run.
{
newStr
+= oldStr.substring(srchNdx,oldStr.indexOf(findStr,srchNdx));
// Put it all the unaltered text from one findStr to
// the next findStr into newStr.
newStr
+= repStr;
// Instead of putting the old string, put in the
// new string instead.
srchNdx
= (oldStr.indexOf(findStr,srchNdx) + findStr.length);
// Now jump to the next chunk of text till the next findStr.
}
newStr
+= oldStr.substring(srchNdx,oldStr.length);
// Put whatever's left into newStr.
return newStr;
}
Good Luck,
Views
Replies
Total Likes
I would use the following JS code in the 'exit' event of the List box
var
ListValue = this.rawValue;
ListValue
= replaceAll(ListValue, "\n", " ,");
TextField1.rawValue
= ListValue;
function
replaceAll(oldStr,findStr, repStr) {
var srchNdx = 0; // srchNdx will keep track of where in the whole line// of oldStr are we searching.
var newStr = ""; // newStr will hold the altered version of oldStr.
while (oldStr.indexOf(findStr,srchNdx) != -1)
// As long as there are strings to replace, this loop
// will run.
{
newStr
+= oldStr.substring(srchNdx,oldStr.indexOf(findStr,srchNdx));
// Put it all the unaltered text from one findStr to
// the next findStr into newStr.
newStr
+= repStr;
// Instead of putting the old string, put in the
// new string instead.
srchNdx
= (oldStr.indexOf(findStr,srchNdx) + findStr.length);
// Now jump to the next chunk of text till the next findStr.
}
newStr
+= oldStr.substring(srchNdx,oldStr.length);
// Put whatever's left into newStr.
return newStr;
}
Good Luck,
Views
Replies
Total Likes
Thanks, I'll give that a try.
Joe
Views
Replies
Total Likes