Nested If Then with Multiple Conditions - Showing Last Option Chosen
Here's a stumper for you.
I have been trying to create a form which can have certain fields resize to handle additional input. There are 3 different fields that can be resized by the user and then the form spawns or deletes pages to show the fields at the sizes the people have chosen. In all, there are 27 different field combinations. In order to accomodate this, I have been trying to use nested if statements. The options are simply "Small Size", "Medium Size", and "Large Size" for each field. The problem I'm running into is that the beginning option when the form loads is "Small Size" and the page shows the appropriate size field. When I choose "Medium" though, "Small" stays. Then when I choose "Large", "Medium" shows up. Then when I choose "Small" or "Medium", "Large" will show all with the proper accompanying pages. The form is showing the fields and pages of the last option that was chosen when you click the next option. Gosh this sounds insane and I hope it's not too confusing. I have other less complicated dropdowns to show or hide fields/pages and this is the only one that won't work.
Here is the partial nested if-thens that I used.
var Drop1 = this.getField("Drop.01").value;
var Drop2 = this.getField("Drop.02").value;
var Drop3 = this.getField("Drop.03").value
if( event.value == "Drop.01" ) {
this.getField("1K.").display = display.visible; } \\ this seemed unnecessary before, so I took it out once. No Difference.
else if( Drop1 == "Small Size" ) {
if( Drop2 == "Small Size" && Drop3 == "Small Size" ) {
var expTplt1 = getTemplate("1K1-2");
expTplt1.spawn(numPages,false,false);
var expTplt2 = getTemplate("1K1-3");
expTplt2.spawn(numPages,false,false);
var expTplt3 = getTemplate("1K1-4");
expTplt3.spawn(numPages,false,false);
this.pageNum = 1;}
else if( Drop2 == "Medium Size" && Drop3 == "Small Size" ) {
var expTplt1 = getTemplate("1K2-2");
expTplt1.spawn(numPages,false,false); \\...
\\ ... additional options
}
else if( Drop1 == "Medium Size" ) {
if( Drop2 == "Small Size" && Drop3 == "Small Size" ) {
var expTplt1 = getTemplate("1K4-2");
expTplt1.spawn(numPages,false,false);
var expTplt2 = getTemplate("1K4-3");
expTplt2.spawn(numPages,false,false);
var expTplt3 = getTemplate("1K4-4");
expTplt3.spawn(numPages,false,false);
this.pageNum = 1;}
\\ ... additional options
}
else if( Drop1 == "Large Size" ) {
if( Drop2 == "Small Size" && Drop3 == "Small Size" ) {
var expTplt1 = getTemplate("1K7-2");
expTplt1.spawn(numPages,false,false);
var expTplt2 = getTemplate("1K7-3");
expTplt2.spawn(numPages,false,false);
var expTplt3 = getTemplate("1K7-4");
expTplt3.spawn(numPages,false,false);
var expTplt4 = getTemplate("1K7-5");
expTplt4.spawn(numPages,false,false);
this.pageNum = 1;}
\\ ... additional options
}
else { this.getField("1K.").display = display.visible; }
Hopefully you get the idea. There's probably a way easier way to do this, but I can't think of what it is at this point. I've been working on this for several days now. Help please!!!
