Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

I want to populate text box from a checkbox

New Here ,
May 03, 2023 May 03, 2023

I'm new to forms and scripting. I'm trying to get a value from a single checkbox into a textfield. I have multiple checkboxes so I only want one to be checked at a time. There are 3 boxes that have the same value, but I still need to have just one checked. (there is other info on the form that another department uses, but isn't important for this) I read that the checkboxes can be named the same but have different export values, I have entered the info for each checkbox. my problem is I can't get anything to display in the textbox. I'm sure there is more to the script that I'm using, I just don't know what it is. 

 

this.getField("cutsize").exportValues = [event.value];

 

Chad29512872d8xq_0-1683151781040.png    Chad29512872d8xq_1-1683151960167.png

TOPICS
How to , JavaScript , PDF forms
1.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
1 ACCEPTED SOLUTION
Community Expert ,
May 09, 2023 May 09, 2023
LATEST

Just to point out, you used two different field names in your post, "CutSize" and "Cutsize".

Give those 3 checkboxes unique export value like: A, B and C, then use this script:

var check = this.getField("Cutsize").valueAsString;
if(check!="Off"){
 if(check=="A"||check=="B"||check=="C")
 event.value = '7 9/32"';
 else
 event.value = check;}
else
event.value ="";

 

View solution in original post

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 09, 2023 May 09, 2023

So I figured most of this out. I'm just haveing proplems with the 3 boxes with the same vaules in them. I need them to be checked individually so not to confuse a different department. Here is the script I'm using .

event.value = this.getField("CutSize").value;
if (this.getField("Cutsize").value =="Off") event.value ="";

Chad29512872d8xq_0-1683640806141.png

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 09, 2023 May 09, 2023
LATEST

Just to point out, you used two different field names in your post, "CutSize" and "Cutsize".

Give those 3 checkboxes unique export value like: A, B and C, then use this script:

var check = this.getField("Cutsize").valueAsString;
if(check!="Off"){
 if(check=="A"||check=="B"||check=="C")
 event.value = '7 9/32"';
 else
 event.value = check;}
else
event.value ="";

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines