Copy link to clipboard
Copied
I've got a drop down menu that is called Ressourcen and a single text field that is called Zusatztext3. Now I would like to insert every selection that is made in the drop down, into my text field. But everytime I select a element in the drop down menu, it appears twice in the text field. How can I fix that, I want it to appear only once.
My current Javascript:
for(var i=1;i<10;i++){
if(this.getField("Ressourcen".value == i){
this.getField("Zusatztext3").value += event.value;
this.getField("Zusatztext3").value += ",";
}}
Copy link to clipboard
Copied
As validation script use:
this.getField("Zusatztext3").value += event.value + ",";
Copy link to clipboard
Copied
You added the script to the wrong location. It needs to be a Validation script, not a Format script.
Copy link to clipboard
Copied
Where does you use this wrong script?
Copy link to clipboard
Copied
I've created a Adobe Acrobat DC pro PDF form and I inserted the script into the JavaScript option (in the tab format) in the drop down menu "Ressourcen"
Copy link to clipboard
Copied
Why does you use the for loop?
Copy link to clipboard
Copied
Because I want to insert every selection from the drop down menu into the text field. For example if I click on the item apple and after that I click on the item banana in the drop down Menu, then I want it the be displayed as: apple, banana in the text field. But my problem is that it is being displayed as apple, apple, banana, banana right now.
Copy link to clipboard
Copied
As validation script use:
this.getField("Zusatztext3").value += event.value + ",";
Copy link to clipboard
Copied
I run into the same problem with this script. The selected element appears multiple times in the text field. But I only selected it once.
Copy link to clipboard
Copied
Can you share the form?
Copy link to clipboard
Copied
I added the form to my post.
Copy link to clipboard
Copied
You added the script to the wrong location. It needs to be a Validation script, not a Format script.
Copy link to clipboard
Copied
Thank you! It works now

