Copy link to clipboard
Copied
Hello. My form (created using Acrobat Pro) contains a number of text fields (named Text1, Text2, etc.), each with a corresponding check box (Check1, Check2, etc.). The check boxes allow the user to highlight specific text fields to indicate that the information recorded represents a "priority" area. As the form is long and contains quite a few text boxes it would be really useful if, at the end of the form, all the "priority" text fields the user has selected could be copied into a single text field - providing a neat summary of the priority areas - maybe automatically or by pressing a button. Would this sort of thing be at all possible? Many thanks
As custom calculation script of field where you want to show text use this code and don't forget to set field as 'Multi-line' in field properties under options tab:
var total = "";
for(var i=1; i<=92; i++){
if(this.getField("Check"+i).valueAsString != "Off")
total+=this.getField("Text"+i).valueAsString+"\n";}
event.value = total;
If you wish to use button instead just change event.value with this.getField("field name goes here").value and put code as Mouse Up event of a button.
Copy link to clipboard
Copied
Yes, it's possible.
1) You want to copy text from priority fields into one field? if yes, you want each priority field text on separate line or just separate by space,dash or something else?
2) How many fields or checkboxes you have exactly?
Copy link to clipboard
Copied
Thats great! Ideally I'd like each field text on a separate line. There are 92 text boxes in total with 92 corresponding check boxes.
Many thanks, Mark
Copy link to clipboard
Copied
As custom calculation script of field where you want to show text use this code and don't forget to set field as 'Multi-line' in field properties under options tab:
var total = "";
for(var i=1; i<=92; i++){
if(this.getField("Check"+i).valueAsString != "Off")
total+=this.getField("Text"+i).valueAsString+"\n";}
event.value = total;
If you wish to use button instead just change event.value with this.getField("field name goes here").value and put code as Mouse Up event of a button.
Copy link to clipboard
Copied
Excellent! Thanks Nesa, that works perfectly! Much appreciated. Mark.
Copy link to clipboard
Copied
This is all looking great now, but (just to be cheeky!), is there any way for each line to start with a bullet point? Don't worry if not, but now I see the text together bullet points may help the way it reads. Thanks again for your help. Mark
Copy link to clipboard
Copied
Yes, you can add it like this:
var total = "";
for(var i=1; i<=92; i++){
if(this.getField("Check"+i).valueAsString != "Off")
total+="• "+this.getField("Text"+i).valueAsString+"\n";}
event.value = total;
You can change "• " to "•" if you don't want space between bullet point and text or add even more space if you wish.
Copy link to clipboard
Copied
Perfect! Thanks Nesa. Mark
Copy link to clipboard
Copied
Hi Nesa,
I have a similar situation but can't get the script below to work. I have a number of check boxes. When each one is check I would like a different bit of text to be inserted into a large textbox thereby creating a "to do" list for my patients.
Thanks,
John
Copy link to clipboard
Copied
Where is text that you wish to be entered in multiline text field,is it in other text fields?
What code did you try?
If you referring to the last script with bullet point,
Il mark part of code you need to pay attention to (field names and number of fields):
var total = "";
for(var i=1; i<=92; i++){
if(this.getField("Check"+i).valueAsString != "Off")
total+="• "+this.getField("Text"+i).valueAsString+"\n";}
event.value = total;
92 - number of checkboxes and text fields(where text is to be populated into multiline text field) you change this to the number of your fields and they need to be named in order(example from the script: Check1,Check2,Check3...etc Text1,Text2,Text3...etc).
Copy link to clipboard
Copied
Where is text that you wish to be entered in multiline text field,is it in other text fields? I would like to be able to define the text which populates when each text box is checked.
What code did you try? Should I run this as a JS Action or a Custom Calculation Script?
Attached is a sample of what I am trying to do
Thanks. I appreciate your help!
Copy link to clipboard
Copied
See if this is what you want, script is in "Short Term" field as "Custom calculation script", it will be easy for you to add new fields and text into the script:
https://drive.google.com/uc?export=download&id=1ds1d-oje2GfA_DCXBiC5HXoeKo0I4xeF