Avatar

Level 2

I've created a form with text fields that are hidden or visible depending upon selections made in two previous drop-down lists. The user of the form has different text fields to type into depending on their choice. The problem I'm having is that I only want to retain the contents of the visible field and only want the contents of the visible field to be saved in the XML of .csv. In other words--if they make another selection from the drop-down lists to "activate" different text fields--the text in the previously visible text fields would be deleted. I'm sure the logic has something to do with "if presence = hidden, then value = null" but I'm completely new to scripting in LiveCycle and have no idea how to write this.

I don't see a way to post a PDF, but I've inserted my code below.

----- form1.#subform[0].VariableLocation::exit: - (JavaScript, client) -----------------------------

//Clear out the StaticLocation DropDown list

StaticLocation.rawValue = "";

StaticLocation.clearItems();

switch (this.rawValue)

{

case "Top Center  ":

StaticLocation.addItem("Lower Right");

StaticLocation.addItem("None");

break;

case "Lower Right":

StaticLocation.addItem("Top Center  ");

StaticLocation.addItem("None");

break;

case "Top Center":

StaticLocation.addItem("Lower Left");

StaticLocation.addItem("None");

break;

case "Lower Left":

StaticLocation.addItem("Top Center");

StaticLocation.addItem("None");

break;

}

//TextFields 1a-4a

if (this.rawValue == "Top Center")

{

     TextField1a.presence = "visible";

}

else

{

     TextField1a.presence = "hidden";

}

if (this.rawValue == "Lower Left")

{

     TextField2a.presence = "visible";

}

else

{

     TextField2a.presence = "hidden";

}

if (this.rawValue == "Top Center  ")

{

     TextField3a.presence = "visible";

}

else

{

     TextField3a.presence = "hidden";

}

if (this.rawValue == "Lower Right")

{

     TextField4a.presence = "visible";

}

else

{

     TextField4a.presence = "hidden";

}

//TextFields 1b-4b

if (this.rawValue == "Top Center")

{

     TextField1b.presence = "visible";

}

else

{

     TextField1b.presence = "hidden";

}

if (this.rawValue == "Lower Left")

{

     TextField2b.presence = "visible";

}

else

{

     TextField2b.presence = "hidden";

}

if (this.rawValue == "Top Center  ")

{

     TextField3b.presence = "visible";

}

else

{

     TextField3b.presence = "hidden";

}

if (this.rawValue == "Lower Right")

{

     TextField4b.presence = "visible";

}

else

{

     TextField4b.presence = "hidden";

}

//TextFields 1c-4c

if (this.rawValue == "Top Center")

{

     TextField1c.presence = "visible";

}

else

{

     TextField1c.presence = "hidden";

}

if (this.rawValue == "Lower Left")

{

     TextField2c.presence = "visible";

}

else

{

     TextField2c.presence = "hidden";

}

if (this.rawValue == "Top Center  ")

{

     TextField3c.presence = "visible";

}

else

{

     TextField3c.presence = "hidden";

}

if (this.rawValue == "Lower Right")

{

     TextField4c.presence = "visible";

}

else

{

     TextField4c.presence = "hidden";

}

//TextFields 1d-4d

if (this.rawValue == "Top Center")

{

     TextField1d.presence = "visible";

}

else

{

     TextField1d.presence = "hidden";

}

if (this.rawValue == "Lower Left")

{

     TextField2d.presence = "visible";

}

else

{

     TextField2d.presence = "hidden";

}

if (this.rawValue == "Top Center  ")

{

     TextField3d.presence = "visible";

}

else

{

     TextField3d.presence = "hidden";

}

if (this.rawValue == "Lower Right")

{

     TextField4d.presence = "visible";

}

else

{

     TextField4d.presence = "hidden";

}

//TextFields 1e-4e

if (this.rawValue == "Top Center")

{

     TextField1e.presence = "visible";

}

else

{

     TextField1e.presence = "hidden";

}

if (this.rawValue == "Lower Left")

{

     TextField2e.presence = "visible";

}

else

{

     TextField2e.presence = "hidden";

}

if (this.rawValue == "Top Center  ")

{

     TextField3e.presence = "visible";

}

else

{

     TextField3e.presence = "hidden";

}

if (this.rawValue == "Lower Right")

{

     TextField4e.presence = "visible";

}

else

{

     TextField4e.presence = "hidden";

}

//TextFields 1f-4f

if (this.rawValue == "Top Center")

{

     TextField1f.presence = "visible";

}

else

{

     TextField1f.presence = "hidden";

}

if (this.rawValue == "Lower Left")

{

     TextField2f.presence = "visible";

}

else

{

     TextField2f.presence = "hidden";

}

if (this.rawValue == "Top Center  ")

{

     TextField3f.presence = "visible";

}

else

{

     TextField3f.presence = "hidden";

}

if (this.rawValue == "Lower Right")

{

     TextField4f.presence = "visible";

}

else

{

     TextField4f.presence = "hidden";

}

//TextFields 1g-4g

if (this.rawValue == "Top Center")

{

     TextField1g.presence = "visible";

}

else

{

     TextField1g.presence = "hidden";

}

if (this.rawValue == "Lower Left")

{

     TextField2g.presence = "visible";

}

else

{

     TextField2g.presence = "hidden";

}

if (this.rawValue == "Top Center  ")

{

     TextField3g.presence = "visible";

}

else

{

     TextField3g.presence = "hidden";

}

if (this.rawValue == "Lower Right")

{

     TextField4g.presence = "visible";

}

else

{

     TextField4g.presence = "hidden";

}

//TextFields 1h-4h

if (this.rawValue == "Top Center")

{

     TextField1h.presence = "visible";

}

else

{

     TextField1h.presence = "hidden";

}

if (this.rawValue == "Lower Left")

{

     TextField2h.presence = "visible";

}

else

{

     TextField2h.presence = "hidden";

}

if (this.rawValue == "Top Center  ")

{

     TextField3h.presence = "visible";

}

else

{

     TextField3h.presence = "hidden";

}

if (this.rawValue == "Lower Right")

{

     TextField4h.presence = "visible";

}

else

{

     TextField4h.presence = "hidden";

}

//TextFields 1i-4i

if (this.rawValue == "Top Center")

{

     TextField2i.presence = "visible";

}

else

{

     TextField2i.presence = "hidden";

}

if (this.rawValue == "Lower Left")

{

     TextField1i.presence = "visible";

}

else

{

     TextField1i.presence = "hidden";

}

if (this.rawValue == "Top Center  ")

{

     TextField4i.presence = "visible";

}

else

{

     TextField4i.presence = "hidden";

}

if (this.rawValue == "Lower Right")

{

     TextField3i.presence = "visible";

}

else

{

     TextField3i.presence = "hidden";

}

.