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

Other available options to activate java script in drop down menu?

Community Beginner ,
Aug 14, 2023 Aug 14, 2023

Hi there,

I have a PDF-document with two drop down menus in it. The items in the second menu are depended on the option chosen in the first menu. I used JavaScript for this. Unfortunately, the only working option to start the JavaScript seems to be to "deactivate" the first menu by clicking somewhere out of the menu box. This means, that the second menu does not change immediately but only when I click on the second menu (or somewhere in the document). Is there any option to start the JavaScript with the click on an item in the first menu? Or a Workaround?

I attached the file in question.

Thanks for the help.

TOPICS
JavaScript , PDF , PDF forms
1.3K
Translate
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
1 ACCEPTED SOLUTION
Community Expert ,
Aug 14, 2023 Aug 14, 2023

That's because you are using export values.

In your script change export values with display value, for example:

replace:

"wahl"

with:

"Bitte wählen Sie ihren Studiengang"

 

Tip:

some choices have same items you could shorten your script by using multiple cases for those items, for example:

case "alt-GS":

case "alt-OS":
this.getField("Modulauswahl").setItems(["Sprecherziehung, Bildungswissenschaftliche Vertiefung und Allgemeine Qualifikation","Fachliche und Überfachliche Vertiefung I","Fachliche und Überfachliche Vertiefung II"]);
break;

View solution in original post

Translate
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 ,
Aug 14, 2023 Aug 14, 2023

Put the script in 'Validate' tab and also in dropdown field 'Options' tab, check 'Commit selected value immediately'.

Translate
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 ,
Aug 14, 2023 Aug 14, 2023

Hi Nesa,

thanks for your answer. Sadly, this did not work. Maybe it is because of the script?

 

switch (event.value) {
case "wahl":
this.getField("Modulauswahl").setItems(["Bitte wählen Sie zuerst ihren Studiengang aus"]);
break;
case "alt-GS":
this.getField("Modulauswahl").setItems(["Sprecherziehung, Bildungswissenschaftliche Vertiefung und Allgemeine Qualifikation","Fachliche und Überfachliche Vertiefung I","Fachliche und Überfachliche Vertiefung II"]);
break;
case "alt-OS":
this.getField("Modulauswahl").setItems(["Sprecherziehung, Bildungswissenschaftliche Vertiefung und Allgemeine Qualifikation","Fachliche und Überfachliche Vertiefung I","Fachliche und Überfachliche Vertiefung II"]);
break;
case "alt-GYM":
this.getField("Modulauswahl").setItems(["Sprecherziehung, Bildungswissenschaftliche Vertiefung und Allgemeine Qualifikation","Fachliche und Überfachliche Vertiefung I","Fachliche und Überfachliche Vertiefung II"]);
break;
case "alt-BBS":
this.getField("Modulauswahl").setItems(["Berufspädagogische und psychologische Vertiefung sowie Allgemeine Qualifikation (EGS-SEBS-1)","Bildungswissenschaftliche und Fachliche Vertiefung und Erweiterung (EGS-SEBS-2)","Sprecherziehung, Bildungswissenschaftliche und Fachliche Vertiefung, Allgemeine Qualifikation (EGS-SEBS-3)"]);
break;
case "neu-GS":
this.getField("Modulauswahl").setItems(["Grundlagen Medienbildung","Kommunikationspädagogik und Allgemeine Qualifikation","Medienbildung","Kommunikationspädagogik und politische Bildung","Vertiefte bildungswissenschaftliche und fachdidaktische Aspekte","Internationalisierung und interkulturelle Bildung","Forschungsprojekt","Spracherwerb (eine Sprache)","Kombinierter Spracherwerb (Zwei Sprachen)"]);
break;
case "neu-OS":
this.getField("Modulauswahl").setItems(["Grundlagen Medienbildung","Kommunikationspädagogik und Allgemeine Qualifikation","Medienbildung","Kommunikationspädagogik und politische Bildung","Vertiefte bildungswissenschaftliche und fachdidaktische Aspekte","Internationalisierung und interkulturelle Bildung","Forschungsprojekt","Spracherwerb (eine Sprache)","Kombinierter Spracherwerb (Zwei Sprachen)","Erweiterter Spracherwerb (eine oder zwei Sprachen)"]);
break;
case "neu-GYM":
this.getField("Modulauswahl").setItems(["Grundlagen Medienbildung","Kommunikationspädagogik und Allgemeine Qualifikation","Medienbildung","Kommunikationspädagogik und politische Bildung","Vertiefte bildungswissenschaftliche und fachdidaktische Aspekte","Internationalisierung und interkulturelle Bildung","Forschungsprojekt","Spracherwerb (eine Sprache)","Kombinierter Spracherwerb (Zwei Sprachen)","Erweiterter Spracherwerb (eine oder zwei Sprachen)"]);
break;
case "neu-BBS":
this.getField("Modulauswahl").setItems(["Grundlagen Medienbildung","Kommunikationspädagogik und Allgemeine Qualifikation","Medienbildung","Kommunikationspädagogik und politische Bildung","Vertiefte bildungswissenschaftliche und fachdidaktische Aspekte","Internationalisierung und interkulturelle Bildung","Forschungsprojekt","Spracherwerb (eine Sprache)","Kombinierter Spracherwerb (Zwei Sprachen)"]);
break;
}

Thanks

Steffen

Translate
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 ,
Aug 14, 2023 Aug 14, 2023

That's because you are using export values.

In your script change export values with display value, for example:

replace:

"wahl"

with:

"Bitte wählen Sie ihren Studiengang"

 

Tip:

some choices have same items you could shorten your script by using multiple cases for those items, for example:

case "alt-GS":

case "alt-OS":
this.getField("Modulauswahl").setItems(["Sprecherziehung, Bildungswissenschaftliche Vertiefung und Allgemeine Qualifikation","Fachliche und Überfachliche Vertiefung I","Fachliche und Überfachliche Vertiefung II"]);
break;

Translate
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 ,
Aug 14, 2023 Aug 14, 2023
LATEST

It works. Thanks sooo much Nesa!!! You were a great help!

Translate
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