Skip to main content
Known Participant
February 7, 2024
Question

Adding text to a text box when multiple checkboxes are marked

  • February 7, 2024
  • 1 reply
  • 1226 views

I am working on adding text to a text box when multiple checkboxes are marked/selected. I have looked all through the links that have been sent to me and tried several suggested options, but nothing is working for me. (this is why I do not make my living as a code specialist!) 

 

I need for these boxes outlined in Red :

 

to add text to this box below all at the same time if the box is checked.. 

 

 

I will be doing this same thing from drop down boxes once I have this part with the checkmarks completed.

Thanks in advance for any assistance for this newbie! 

This topic has been closed for replies.

1 reply

Nesa Nurani
Community Expert
Community Expert
February 8, 2024

You can use something like this as custom calculation script of text field where you want to show text:

var c1 = this.getField("Check Box1").valueAsString;
var c2 = this.getField("Check Box2").valueAsString;
var c3 = this.getField("Check Box3").valueAsString;
//Use your actual names for the checkboxes

if(c1 !== "Off" && c2 !== "Off" && c3 !== "Off")
 event.value = "Some text";
else
 event.value = "";//set event.value to desired value when chekboxes are not checked
Known Participant
February 8, 2024

Thank-you so much! 

In this line.......... 

set event.value to desired value when chekboxes are not checked

Is this where I type the text that I want to  be placed in this text box? The text for each checkbox is different; do I add all 3 options in this spot? 

Nesa Nurani
Community Expert
Community Expert
February 8, 2024

event.value = "" means if no conditions are met field will be empty, instead of set field to be empty you can set it to some other default text if you need, if not than leave as it is.

Where it says "Some text" that is where you input your text to show in the field.

If you have multiple text, use 'else if' conditions for each text.