I tackled a similar thing to this. Mine is slightly different and puts each item on a separate line, but it should give you the general idea.
I have a Button, a TextField and three checkboxes and the code uses FormCalc
form1.pageDocumentSetup.btnConcatFruit::click - (FormCalc, client)
var lb = "\u000a" //linebreak character code. Use to create a line break between each item.
TextField1.rawValue = null; //clears the text field when the button is clicked
if(cbApple.rawValue == 1) then TextField1 = concat(TextField1, lb, "Apple") endif
if(cbOrange.rawValue == 1) then TextField1 = concat(TextField1, lb, "Orange") endif
if(cbPear.rawValue == 1) then TextField1 = concat(TextField1, lb, "Pear") endif