Skip to main content
Participant
March 24, 2017
Question

Check boxes automatically populating a new text field

  • March 24, 2017
  • 1 reply
  • 535 views

I have 7 check boxes with different results.  I now want to make a text field that brings those results from the checked off boxes to a new text field.  How do I do it?

Example:

say the check boxes are "1", "2", "3", etc.

then in my text field I need to make an If statement, if box 1 and 3 and 5 are checked, then it prints 1, 3, 5

if just 1 is checked, then just "1" will print

Does that make sense?

  FIRST TIME USER !!

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
March 24, 2017

You can use this code as the custom calculation script of your text field:

var fields = ["1", "2", "3", "4", "5"];

var values = [];

for (var i in fields) {

    var f = this.getField(fields);

    if (f.value!="Off") {

        values.push(fields);

    }  

}

event.value = values.join(", ");

Participant
April 6, 2017

okay i think i have this setup incorrectly -- my check box is 1 and next to it currently i have a text - say Blue - but that has to be a formatted field, correct?  - and then i want another field to print BLUE if check box 1 is checked - - or is there away of labeling the CheckBox 1 - to print BLUE if checked?

i don't even know what i'm asking anymore !  : )

EX:

checkbox1     Obesity

checkbox2     Clots

so on another page if checkbox1 is checked, it will automatically print "Obesity"

Inspiring
April 6, 2017

You need to set the Export Value for the check box to the text you want displayed. Then the script should work. If you cannot set the export value then you need to add more code to properly fill the array with the text value you want displayed.