Skip to main content
andrek4901123
Participating Frequently
June 24, 2019
Question

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?

  • June 24, 2019
  • 2 replies
  • 774 views

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

This topic has been closed for replies.

2 replies

Bernd Alheit
Community Expert
Community Expert
June 26, 2019

What does you mean with "Aktionen E2" ?

andrek4901123
Participating Frequently
June 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.

try67
Community Expert
Community Expert
June 26, 2019

But what exact action are you using?

try67
Community Expert
Community Expert
June 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.

andrek4901123
Participating Frequently
June 26, 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