I'm creating an interactive pdf form with the hyperref package. The form is quite comprehensive, so the current goal is to only show parts that are relevant to the specific user. For example, the user indicates that he is male --> only the items that concern males are displayed.
Usually it's not difficult to display only certain parts of a document, e.g. using the ifthen package:
\documentclass{article}
\usepackage{ifthen}
\begin{document}
\newboolean{boolvar}
\setboolean{boolvar}{false}
\ifthenelse{\boolean{boolvar}}{show if true}{show if false}
\end{document}
I'm lost, however, when it comes to combining variables like that with user input from form fields. Using JavaScript and the insdljs package, I've gotten as far as hiding form fields, but not text outside of these form fields: (Note: insdljs is not part of TeX Live, but available here)
\documentclass{article}
\usepackage[pdftex]{hyperref}
\usepackage[pdftex]{insdljs}
\begin{insDLJS}{mydljs}{some comment}
function hide(){
if(this.getField("somefield").display == display.visible){
this.getField("somefield").display = display.hidden;
} else{
this.getField("somefield").display = display.visible;
}
}
\end{insDLJS}
\begin{document}
\begin{Form}
\PushButton[onclick={hide();}]{Hide/Show}\\
\TextField[name=somefield, width=4em]{Any way to hide e.g. this text?}
\end{Form}
\end{document}
Hiding form fields like that is very handy, but I'd like to apply that to entire tables or sections. Any idea? Thanks!


after:


