Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Place the code under the Validation event of the drop-down field (M1), and change this line:
var M1=this.getField("M1").value
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.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
What does you mean with "Aktionen E2" ?
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
But what exact action are you using?
Copy link to clipboard
Copied
I had chosen "JavaScript ausführen".
Copy link to clipboard
Copied
What I mean is, what trigger are you using...
Copy link to clipboard
Copied
release the Mouse button
Copy link to clipboard
Copied
You should move it to the Validation event.
Copy link to clipboard
Copied
ok, thank you for your support 🙂