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

Populate text field based on drop down

Community Beginner ,
May 26, 2020 May 26, 2020

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

}}

 

TOPICS
PDF forms

Views

2.3K
Translate

Report

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
2 ACCEPTED SOLUTIONS
Community Expert ,
May 26, 2020 May 26, 2020

Copy link to clipboard

Copied

As validation script use:

this.getField("Zusatztext3").value += event.value + ",";

View solution in original post

Votes

Translate

Report

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 27, 2020 May 27, 2020

Copy link to clipboard

Copied

You added the script to the wrong location. It needs to be a Validation script, not a Format script.

View solution in original post

Votes

Translate

Report

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 26, 2020 May 26, 2020

Copy link to clipboard

Copied

Where does you use this wrong script?

Votes

Translate

Report

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 Beginner ,
May 26, 2020 May 26, 2020

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"

Votes

Translate

Report

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 26, 2020 May 26, 2020

Copy link to clipboard

Copied

Why does you use the for loop?

Votes

Translate

Report

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 Beginner ,
May 26, 2020 May 26, 2020

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.

Votes

Translate

Report

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 26, 2020 May 26, 2020

Copy link to clipboard

Copied

As validation script use:

this.getField("Zusatztext3").value += event.value + ",";

Votes

Translate

Report

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 Beginner ,
May 26, 2020 May 26, 2020

Copy link to clipboard

Copied

Alessaa_1-1590516439758.pngexpand image

 

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.

Votes

Translate

Report

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 26, 2020 May 26, 2020

Copy link to clipboard

Copied

Can you share the form?

Votes

Translate

Report

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 Beginner ,
May 27, 2020 May 27, 2020

Copy link to clipboard

Copied

I added the form to my post.

Votes

Translate

Report

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 27, 2020 May 27, 2020

Copy link to clipboard

Copied

You added the script to the wrong location. It needs to be a Validation script, not a Format script.

Votes

Translate

Report

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 Beginner ,
May 27, 2020 May 27, 2020

Copy link to clipboard

Copied

LATEST

Thank you! It works now

Votes

Translate

Report

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