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

Bei Auswahl einer Option im drop-dpwn menü soll die im Javascript progammierte Abfolge sofort eingeleitet werden. Bisher muss ich ein weiteres mal das drop-down menu anklicken. Kann mir jemand helfen?

New Here ,
Jun 24, 2019 Jun 24, 2019

Hallo,

ich habe ein drop-down menu (M1) mit z.B. Optionen 1 und 2. Bei Auswahl 1 soll textfeld n1, bei Auswahl 2 textfeld n2 bzw. visible werden.

Aktuell jedoch muss ich nach der auswahl erneut das drop-down menu anklicken damit die Programm Abfolge abläuft und die Textfelder entsprechend der Auswahl angezeigt warden. Es ware schön, wenn sofort mit Auswahl der Option die Textfelder nach Programm (javascript) angezeigt warden.

Maus taste loslassen oder drücken ändert nichts oder last sich nicht ändern.

Vielleicht kann mit jemand weiterhelfen?

Hier der code (unter Aktionen E2):

var M1=this.getField("M1").value

if(M1==1)

{

this.getField("n1").display = display.visible;

this.getField("n2").display = display.hidden;

}

else

{

if (M1==2)

{

this.getField("n2").display = display.visible;

this.getField("n1).display = display.hidden;

}

}

Beste Grüße und Danke

TOPICS
Acrobat SDK and JavaScript , Windows
669
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 ,
Jun 24, 2019 Jun 24, 2019

Place the code under the Validation event of the drop-down field (M1), and change this line:

var M1=this.getField("M1").value

To:

var M1=Number(event.value);

Also, make sure to tick the option to commit the selected value immediately, under the field's Properties, Options tab.

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
New Here ,
Jun 25, 2019 Jun 25, 2019

Thank you for your fast response. I changes the code according to your recommendations and it works 🙂

So far I have not considered the validation field for placing code. Just for me to understand and learn, why it works when the code is placed there? What is the difference to the regular action field where I placed the code?

Best regards and thanks again

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 ,
Jun 26, 2019 Jun 26, 2019

What does you mean with "Aktionen E2" ?

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
New Here ,
Jun 26, 2019 Jun 26, 2019

Hi,

this E2 has to be M1, a mistake sorry. Actually I meant that the code is placed under properties, Aktionen field of the drop-down menu M1.

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 ,
Jun 26, 2019 Jun 26, 2019

But what exact action are you using?

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
New Here ,
Jun 26, 2019 Jun 26, 2019

I had chosen "JavaScript ausführen".

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 ,
Jun 26, 2019 Jun 26, 2019

What I mean is, what trigger are you using...

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
New Here ,
Jun 26, 2019 Jun 26, 2019

release the Mouse button

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 ,
Jun 26, 2019 Jun 26, 2019

You should move it to the Validation event.

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
New Here ,
Jun 26, 2019 Jun 26, 2019
LATEST

ok, thank you for your support 🙂

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