Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

Single or multiple check box values displayed in a text field

meem23
Level 4
Level 4


My apologies, this may be a duplicate discussion.

I'm using the following script to display the values of check boxes in a text field.  I would like the word "and" to separate the values if two check boxes are selected. If more than two boxes are selected I want the values to be separated by a comma and then the last value be separated by "and".  Example of two check boxes selected:  A and B.  Example of two or more: A, B, C, and D.  Can this be done?

form1.page1.page1SF.programs::calculate - (JavaScript, client)

//displays the values of check boxes named programCB

var aChkBx = [];

var vChecks = programCB.all;

for (var a=0; a<vChecks.length;a++){

if(!vChecks.item(a).isNull) {

aChkBx.push(vChecks.item(a).rawValue);

}

}

this.rawValue = aChkBx.join(", ");

0 Replies