# [pdftex] hyperref and forms

Victor Ivrii vivrii at gmail.com
Fri Jun 30 02:34:42 CEST 2006

It is  my previous question refined:

Code below creates pdf form with 3 fields, which are numerical, and
the third field is the sum of two first. However if I open it in
Acrobat (or Reader) the third field is not calculated. But if I open
in Acrobat and use Form > TextField tool I see that it should be
calculated; if I click to pick up the fields to have their sum
calculated, I see that the correct fields are checked. If I close
field selection dialog and then exit  TextField tool without doing
nothing, the third field is calculated.

My question: how I should modify the source to have calculation really
enabled without trick I described? Another question: How to calculate
more complicated expression (still in frames of "Simplified Field
Notation"?

\documentclass[10pt]{article}
\usepackage[pdftex]{hyperref}
%\usepackage[pdftex]{eforms}

% Globally change defaults of widgets

\begin{document}
\begin{Form}

\TextField[maxlen=40,keystroke={AFNumber_Keystroke(2, 0, 1, 2,
true);},align=2,height=10pt,width=45pt,name=alpha]{Alpha}

\bigskip
\TextField[maxlen=40,keystroke={AFNumber_Keystroke(2, 0, 1, 2,
true);},align=2,height=10pt,width=45pt,name=beta]{Beta}

\bigskip
\TextField[maxlen=40,keystroke={AFNumber_Keystroke(2, 0, 1, 2, true);},
calculate={AFSimple_Calculate("SUM" , new Array ( "alpha" , "beta" )