Expand my Community achievements bar.

SOLVED

Hidden/Visible text fields in saved PDF

Avatar

Former Community Member

I got some very helpful advice yesterday about deleting content from hidden boxes (text fields). I have another related problem that somebody might have an answer for. I have text fields that are hidden or visible depending on selections made in drop-down lists. This is working fine but I've noticed something strange. When a user completes the form, saves it, closes it, and re-opens it--all of the text boxes are visible. Has anyone run across this? If so--is there some script I can add to fix this?

//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";
     TextField1a.rawValue = ""; 
}



if (this.rawValue == "Lower Left")
{
     TextField2a.presence = "visible";
}
else
{
     TextField2a.presence = "hidden";
     TextField2a.rawValue = ""; 
}


if (this.rawValue == "Top Center  ")
{
     TextField3a.presence = "visible";
}
else
{
     TextField3a.presence = "hidden";
     TextField3a.rawValue = ""; 
}



if (this.rawValue == "Lower Right")
{
     TextField4a.presence = "visible";
}
else
{
     TextField4a.presence = "hidden";
     TextField4a.rawValue = "";
}



//TextFields 1b-4b


if (this.rawValue == "Top Center")
{
     TextField1b.presence = "visible";
}
else
{
     TextField1b.presence = "hidden";
     TextField1b.rawValue = "";
}

if (this.rawValue == "Lower Left")
{
     TextField2b.presence = "visible";
}
else
{
     TextField2b.presence = "hidden";
     TextField2b.rawValue = ""; 
}

if (this.rawValue == "Top Center  ")
{
     TextField3b.presence = "visible";
}
else
{
     TextField3b.presence = "hidden";
     TextField3b.rawValue = "";
}

if (this.rawValue == "Lower Right")
{
     TextField4b.presence = "visible";
}
else
{
     TextField4b.presence = "hidden";
     TextField4b.rawValue = ""; 
}





//TextFields 1c-4c


if (this.rawValue == "Top Center")
{
     TextField1c.presence = "visible";
}
else
{
     TextField1c.presence = "hidden";
     TextField1c.rawValue = ""; 
}

if (this.rawValue == "Lower Left")
{
     TextField2c.presence = "visible";
}
else
{
     TextField2c.presence = "hidden";
     TextField2c.rawValue = "";
}

if (this.rawValue == "Top Center  ")
{
     TextField3c.presence = "visible";
}
else
{
     TextField3c.presence = "hidden";
     TextField3c.rawValue = "";
}

if (this.rawValue == "Lower Right")
{
     TextField4c.presence = "visible";
}
else
{
     TextField4c.presence = "hidden";
     TextField4c.rawValue = "";
}





//TextFields 1d-4d


if (this.rawValue == "Top Center")
{
     TextField1d.presence = "visible";
}
else
{
     TextField1d.presence = "hidden";
     TextField1d.rawValue = "";
}

if (this.rawValue == "Lower Left")
{
     TextField2d.presence = "visible";
}
else
{
     TextField2d.presence = "hidden";
     TextField2d.rawValue = ""; 
}

if (this.rawValue == "Top Center  ")
{
     TextField3d.presence = "visible";
}
else
{
     TextField3d.presence = "hidden";
     TextField3d.rawValue = "";
}

if (this.rawValue == "Lower Right")
{
     TextField4d.presence = "visible";
}
else
{
     TextField4d.presence = "hidden";
     TextField4d.rawValue = "";
}




//TextFields 1e-4e


if (this.rawValue == "Top Center")
{
     TextField1e.presence = "visible";
}
else
{
     TextField1e.presence = "hidden";
     TextField1e.rawValue = ""; 
}

if (this.rawValue == "Lower Left")
{
     TextField2e.presence = "visible";
}
else
{
     TextField2e.presence = "hidden";
     TextField2e.rawValue = "";
}

if (this.rawValue == "Top Center  ")
{
     TextField3e.presence = "visible";
}
else
{
     TextField3e.presence = "hidden";
     TextField3e.rawValue = ""; 
}

if (this.rawValue == "Lower Right")
{
     TextField4e.presence = "visible";
}
else
{
     TextField4e.presence = "hidden";
     TextField4e.rawValue = "";
}





//TextFields 1f-4f


if (this.rawValue == "Top Center")
{
     TextField1f.presence = "visible";
}
else
{
     TextField1f.presence = "hidden";
     TextField1f.rawValue = ""; 
}

if (this.rawValue == "Lower Left")
{
     TextField2f.presence = "visible";
}
else
{
     TextField2f.presence = "hidden";
     TextField2f.rawValue = ""; 
}

if (this.rawValue == "Top Center  ")
{
     TextField3f.presence = "visible";
}
else
{
     TextField3f.presence = "hidden";
     TextField3f.rawValue = "";
}

if (this.rawValue == "Lower Right")
{
     TextField4f.presence = "visible";
}
else
{
     TextField4f.presence = "hidden";
     TextField4f.rawValue = ""; 
}






//TextFields 1g-4g


if (this.rawValue == "Top Center")
{
     TextField1g.presence = "visible";
}
else
{
     TextField1g.presence = "hidden";
     TextField1g.rawValue = ""; 
}

if (this.rawValue == "Lower Left")
{
     TextField2g.presence = "visible";
}
else
{
     TextField2g.presence = "hidden";
     TextField2g.rawValue = ""; 
}

if (this.rawValue == "Top Center  ")
{
     TextField3g.presence = "visible";
}
else
{
     TextField3g.presence = "hidden";
     TextField3g.rawValue = ""; 
}

if (this.rawValue == "Lower Right")
{
     TextField4g.presence = "visible";
}
else
{
     TextField4g.presence = "hidden";
     TextField4g.rawValue = "";
}







//TextFields 1h-4h


if (this.rawValue == "Top Center")
{
     TextField1h.presence = "visible";
}
else
{
     TextField1h.presence = "hidden";
     TextField1h.rawValue = ""; 
}

if (this.rawValue == "Lower Left")
{
     TextField2h.presence = "visible";
}
else
{
     TextField2h.presence = "hidden";
     TextField2h.rawValue = ""; 
}

if (this.rawValue == "Top Center  ")
{
     TextField3h.presence = "visible";
}
else
{
     TextField3h.presence = "hidden";
     TextField3h.rawValue = ""; 
}

if (this.rawValue == "Lower Right")
{
     TextField4h.presence = "visible";
}
else
{
     TextField4h.presence = "hidden";
     TextField4h.rawValue = ""; 
}




//TextFields 1i-4i


if (this.rawValue == "Top Center")
{
     TextField2i.presence = "visible";
}
else
{
     TextField2i.presence = "hidden";
     TextField2i.rawValue = "";     
}


if (this.rawValue == "Lower Left")
{
     TextField1i.presence = "visible"; 
}
else
{
     TextField1i.presence = "hidden";
     TextField1i.rawValue = "";  
}

if (this.rawValue == "Top Center  ")
{
     TextField4i.presence = "visible";
}
else
{
     TextField4i.presence = "hidden";
     TextField4i.rawValue = ""; 
}

if (this.rawValue == "Lower Right")
{
     TextField3i.presence = "visible";
}
else
{
     TextField3i.presence = "hidden";
     TextField3i.rawValue = "";
}

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

if (TrimSize.rawValue == null) {VariableLocation.access = "readOnly";}

else {VariableLocation.access = "open";}


//1a-4a
if (VariableLocation.rawValue == null)
{
     TextField1a.presence = "hidden";
}

if (VariableLocation.rawValue == null)
{
     TextField2a.presence = "hidden";
}


if (VariableLocation.rawValue == null)
{
     TextField3a.presence = "hidden";
}

if (VariableLocation.rawValue == null)
{
     TextField4a.presence = "hidden";
}




//1b-4b

if (VariableLocation.rawValue == null)
{
     TextField1b.presence = "hidden";
}

if (VariableLocation.rawValue == null)
{
     TextField2b.presence = "hidden";
}


if (VariableLocation.rawValue == null)
{
     TextField3b.presence = "hidden";
}

if (VariableLocation.rawValue == null)
{
     TextField4b.presence = "hidden";
}




//1c-4c
if (VariableLocation.rawValue == null)
{
     TextField1c.presence = "hidden";
}

if (VariableLocation.rawValue == null)
{
     TextField2c.presence = "hidden";
}


if (VariableLocation.rawValue == null)
{
     TextField3c.presence = "hidden";
}

if (VariableLocation.rawValue == null)
{
     TextField4c.presence = "hidden";
}





//1d-4d
if (VariableLocation.rawValue == null)
{
     TextField1d.presence = "hidden";
}

if (VariableLocation.rawValue == null)
{
     TextField2d.presence = "hidden";
}


if (VariableLocation.rawValue == null)
{
     TextField3d.presence = "hidden";
}

if (VariableLocation.rawValue == null)
{
     TextField4d.presence = "hidden";
}



//1e-4e
if (VariableLocation.rawValue == null)
{
     TextField1e.presence = "hidden";
}

if (VariableLocation.rawValue == null)
{
     TextField2e.presence = "hidden";
}


if (VariableLocation.rawValue == null)
{
     TextField3e.presence = "hidden";
}

if (VariableLocation.rawValue == null)
{
     TextField4e.presence = "hidden";
}





//1f-4f
if (VariableLocation.rawValue == null)
{
     TextField1f.presence = "hidden";
}

if (VariableLocation.rawValue == null)
{
     TextField2f.presence = "hidden";
}


if (VariableLocation.rawValue == null)
{
     TextField3f.presence = "hidden";
}

if (VariableLocation.rawValue == null)
{
     TextField4f.presence = "hidden";
}







//1g-4g
if (VariableLocation.rawValue == null)
{
     TextField1g.presence = "hidden";
}

if (VariableLocation.rawValue == null)
{
     TextField2g.presence = "hidden";
}


if (VariableLocation.rawValue == null)
{
     TextField3g.presence = "hidden";
}

if (VariableLocation.rawValue == null)
{
     TextField4g.presence = "hidden";
}





//1h-4h
if (VariableLocation.rawValue == null)
{
     TextField1h.presence = "hidden";
}

if (VariableLocation.rawValue == null)
{
     TextField2h.presence = "hidden";
}


if (VariableLocation.rawValue == null)
{
     TextField3h.presence = "hidden";
}

if (VariableLocation.rawValue == null)
{
     TextField4h.presence = "hidden";
}



//1i-4i
if (VariableLocation.rawValue == null)
{
     TextField1i.presence = "hidden";
}

if (VariableLocation.rawValue == null)
{
     TextField2i.presence = "hidden";
}


if (VariableLocation.rawValue == null)
{
     TextField3i.presence = "hidden";
}

if (VariableLocation.rawValue == null)
{
     TextField4i.presence = "hidden";
}

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

You are not saving the state of the form. You can do this programmatically but there is a facility in Designer that will do it for you. If you open the Form Properties under the File menu then click the Defaults tab, you will see a section called Scripting. In that section make sure that the "Preserve Scripting changes to for when saved" radio button is set to Automatically.

Paul

View solution in original post

2 Replies

Avatar

Correct answer by
Former Community Member

You are not saving the state of the form. You can do this programmatically but there is a facility in Designer that will do it for you. If you open the Form Properties under the File menu then click the Defaults tab, you will see a section called Scripting. In that section make sure that the "Preserve Scripting changes to for when saved" radio button is set to Automatically.

Paul

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----