Skip to main content
Known Participant
Mar 13, 2025 11:30 PM UTC
Answered

Using multiple check Boxes or Radio Buttons one at a time to populate a Text Field

I have tried so many solutions, but none seem to work.

 

I have 5 checkboxes with a single name to make them a group.  I have the Export value of each box set to 1 thru 5 respectively. When I check the check box with the export value set to 1, I am trying to get the TextField1  to show the phrase "1-Low" without the quotes of course. If the check box with the export value set to 2 is checked, I am trying to get TextField1 to show "2-Medium" etc... I can change to radio buttons if nessasary.

 

Check box with export value 1 = TextField1 value = 1-Low

Check box with export value 2 = TextField1 value = 2-Medium

Check box with export value 3 = TextField1 value = 3-High

Check box with export value 4 = TextField1 value = 4-Critical

Check box with export value 5 = TextField1 value = 5-Emergency

If none of the check boxes are checked, the TextField1 would be blank.

 

Any help would be sure appreciated.

 

PDF Automation Station
Community Expert
Mar 14, 2025 1:07 AM UTC

Enter the following script as a custom calculation script in TextField1.  Change "Check Box" to the actual check box field name.

var cb=this.getField("Check Box").value;

if(cb==1){event.value="1-Low"} else

if(cb==2){event.value="2-Medium"} else

if(cb==3){event.value="3-High"} else

if(cb==4){event.value="4-Critical"} else

if(cb==5){event.value="5-Emergency"} else

{event.value=""}

3 replies

PDF Automation Station
Community Expert
Community Expert
Mar 14, 2025 1:07 AM UTC

Enter the following script as a custom calculation script in TextField1.  Change "Check Box" to the actual check box field name.

var cb=this.getField("Check Box").value;

if(cb==1){event.value="1-Low"} else

if(cb==2){event.value="2-Medium"} else

if(cb==3){event.value="3-High"} else

if(cb==4){event.value="4-Critical"} else

if(cb==5){event.value="5-Emergency"} else

{event.value=""}

Translate
Known Participant
Mar 14, 2025 1:56 AM UTC

Perfect, Thanks so much.

Translate
Nesa Nurani
Community Expert
Community Expert
Mar 14, 2025 4:30 AM UTC

In the future this can be done much simpler, instead of giving export values 1,2,3...etc use Low, Medium, High...etc

then just use this script:
var cb = this.getField("Check Box").valueAsString;
event.value = (cb !== "Off") ? cb : "";

Translate