Copy link to clipboard
Copied
Hallo, ich habe folgendes Problem:
Ich habe ein Dropdown-Feld mit 2 Auswahlmöglichkeiten.
Wenn die eine Möglichkeit angwählt wurde, soll ein Kontrollkästchen und 2 Textfelder eingeblendet werden,
wenn die andere Möglichkeit ausgewählt wurde, sollen mehrere andere Kontrollkästchen und Textfelder eingeblendet werden.
Ist das machbar und wenn ja wie?
Danke
Copy link to clipboard
Copied
Yes, using a custom validation script.
The basic code is something like this:
if (event.value=="Option 1") {
this.getField("Text1").display = display.visible;
this.getField("Text2").display = display.hidden;
this.getField("Text2").value = "";
} else if (event.value=="Option 2") {
this.getField("Text1").display = display.hidden;
this.getField("Text1").value = "";
this.getField("Text2").display = display.visible;
}
Copy link to clipboard
Copied
Ok, thank you so much for you answer, but i did not get it.
May you please help me again?
Dropdown1 = Approval of
--> Option 1
Dropdown1 = Deviation of
--> Option 2
see below
if (event.value=="Option 1") {
this.getField("Text1").display = display.visible;
this.getField("Check Box1").display = display.visible;
this.getField("Text2").display = display.hidden;
this.getField("Check Box2").display = display.hidden;
this.getField("Text3").display = display.hidden;
this.getField("Check Box3").display = display.hidden;
this.getField("Text4").display = display.hidden;
this.getField("Check Box4").display = display.hidden;
this.getField("Text5").display = display.hidden;
this.getField("Check Box5").display = display.hidden;
this.getField("Text2").value = "";
} else if (event.value=="Option 2") {
this.getField("Text1").display = display.hidden;
this.getField("Check Box1").display = display.hidden;
this.getField("Text2").display = display.visible;
this.getField("Check Box2").display = display.visible;
this.getField("Text3").display = display.visible;
this.getField("Check Box3").display = display.visible;
this.getField("Text4").display = display.visible;
this.getField("Check Box4").display = display.visible;
this.getField("Text5").display = display.visible;
this.getField("Check Box5").display = display.visible;
}
What is wrong?
Thank you
Copy link to clipboard
Copied
You doesn't use "Option 1" and "Option 2" in the dropdown.
Copy link to clipboard
Copied
Oh u r right, thank you so much!
Copy link to clipboard
Copied
You have to adjust the code to reflect the actual values of the drop-down in your file.
So instead of:
if (event.value=="Option 1") {
Use:
if (event.value=="Approval of") {
In addition, you should enable the option to commit the selected values of the drop-downs immediately, under the Options tab in their Properties dialogs.
Copy link to clipboard
Copied
Ok thank you! just for information - why is it essential to enable the option?
Copy link to clipboard
Copied
Otherwise the script will only execute when you exit the field, not at the moment you change the selection in it.