Skip to main content
Participating Frequently
May 3, 2023
Answered

I want to populate text box from a checkbox

  • May 3, 2023
  • 1 reply
  • 1048 views

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];

 

    

This topic has been closed for replies.
Correct answer Nesa Nurani

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 ="";

 

1 reply

Participating Frequently
May 9, 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 ="";

 

Nesa Nurani
Community Expert
Nesa NuraniCommunity ExpertCorrect answer
Community Expert
May 9, 2023

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 ="";