I want to show the computation of two values in the questionaire where the user choose one option per question.
Many measure proprietary sources of research have PDF documents such as Mielenterveystalo.fi which have such a feature.
I am thinking how to accomplish it with LaTeX.
The task is the computation (2+2
) from checkboxes and then showing the result (4
).
Expected frontend in Fig. 1.
Most potential thread answer about the issue is the answer here with etoolbox
package but from 2012 approach so I hope the approach has improved.
Code where no checkboxes and gamma box is not a textbox so not accepting input
\documentclass{article}
\usepackage{amssymb}
\usepackage{hyperref}
\begin{document}
\begin{Form}
% TODO make two questions with three checkboxes
% https://tex.stackexchange.com/a/76500/13173
\TextField[maxlen=40,align=2,height=10pt,width=45pt,name=alpha]{Alpha}
\bigskip
\TextField[maxlen=40,align=2,height=10pt,width=45pt,name=beta]{Beta}
\bigskip
\TextField[
maxlen=40,
calculate={%
var f_alpha = this.getField("alpha");
var f_beta = this.getField("beta");
event.value = f_alpha.value + f_beta.value;
},
align=2,height=10pt,width=45pt,name=gamma,readonly=true]{Gamma}
\end{Form}
% Count core here
Summary score:
\end{document}
Bugs in the code
- does not prevent selection of one or more options. Allow selection two options per question but count the average then. Connect average function then there.
Action: check two places of point (2) in questions (1-2)
Expected output: show value 4 in Summary Score in Adobe Acrobat (acroread
in Linux)
Fig. 1 Expected frontend
OS: Debian 9
TeXLive: 2017
hyperref
for this – user31729 Aug 1 '17 at 15:03