Copy link to clipboard
Copied
Hi,
I'm trying to make a form with acrobat where I have a list of items associated with a checkbox, and I would like to display the items checked in a separate textfield.
Thank you for your time and help !
Doing it in columns is tricky. It will only display properly if the texts are all more or less the same length.
You can use this code (as the custom calculation script of the text field) to show each item on a separate line:
var summary = "";
var counter = 0;
for (var i=1; i<=48; i++) {
if (this.getField("Box"+i).valueAsString!="Off") {
counter++;
summary+=this.getField("Box"+i).userName+"\r";
}
}
summary+="Total number of boxes ticked: " + counter;
event.value = summary;
You are missing "Box37" field.
Copy link to clipboard
Copied
Why my post keeps getting flagged as innappropriate ????
Copy link to clipboard
Copied
and again it was deleted....
how is this innappropriate ??????????
Copy link to clipboard
Copied
That is odd. I will follow up regarding your post with those in charge and hopefully it will get unblocked soon enough.
Copy link to clipboard
Copied
Thank you Try67 !
Copy link to clipboard
Copied
It seems your two posts were merged, and unlocked. I was told they were flagged (incorrectly) automatically by the forum's spam system, so don't take it personally.
To answer your question: Yes, this is possible with a script. What are the names of the check-boxes? What values do you want to use when they are ticked (using the field-names, or the export values, or something else)? And how do you want them to be combined (each item on a separate line, or separated by a comma, or something else)?
Copy link to clipboard
Copied
Ok, thank you for letting me know what happend.
My check-box names are Box1 to Box48, and I would like to display the tooltip if possible, as it correspond to the item name in the list. Each item on a separate line would be perfect, on 2 or 3 columns (can be up to a selection of 20 items). Would it be possible to display the amount of total item selected ? I don't know if it matters but I have added the check-box in word before exporting it to Acrobat.
Thank you very much for your time and help, it is very appreciated.
Copy link to clipboard
Copied
Doing it in columns is tricky. It will only display properly if the texts are all more or less the same length.
You can use this code (as the custom calculation script of the text field) to show each item on a separate line:
var summary = "";
var counter = 0;
for (var i=1; i<=48; i++) {
if (this.getField("Box"+i).valueAsString!="Off") {
counter++;
summary+=this.getField("Box"+i).userName+"\r";
}
}
summary+="Total number of boxes ticked: " + counter;
event.value = summary;
Copy link to clipboard
Copied
Wow... Worked like a charm. I am amazed about your efficiency ! 🙂 Will keep it in one column as there is enough space to display the 20 items.
Thank you very much for your help !
Copy link to clipboard
Copied
Hi Try67, I'm coming back to you today because I have tried to use this script on another document and it just won't work. I have double checked everything and I did everything exactly like yesterday for the first document. I have Box1 to 64 (changed the script to go to 64) but it wont even show anything in the field text 😞 If you have any lead on what can prevent the script from working, it will be really appreciated.
Copy link to clipboard
Copied
Are there any errors in the JS Console?
Copy link to clipboard
Copied
Hi guys, thank you for your answers !
@try67I didn't see any errors in the JS Console.
@Nesa NuraniYes I used the script as calculation and made sure the name of the box was the good one in the script, I have checked all typos error I could make.
Copy link to clipboard
Copied
Can you share that file with us?
Copy link to clipboard
Copied
HI Nesa,
Not sur if this link works to see the form fields but here it is : https://acrobat.adobe.com/link/review?uri=urn:aaid:scds:US:8fdda961-362b-321b-b2cd-512c2e873146
Copy link to clipboard
Copied
You are missing "Box37" field.
Copy link to clipboard
Copied
Thank you Nesa, I saw this but I naively taught that it won't affect the script 😞 Works well now, thank you !
Copy link to clipboard
Copied
Did you use script as 'Calculation'?
Check field names, if for example one field is named "Box 2" instead of "Box2" script won't work.