\documentclass{article}
\usepackage{amsmath}
\usepackage
    [dvipsone,
     designvi,
     tight,
     nodirectory,
     usetemplates]{web}  % dvipsone, dvips, pdftex, dvipdfm
\usepackage[execJS,nodljs]{exerquiz} %[execJS,nodljs]
\usepackage{calc}

\title{\texorpdfstring{Acro\!\TeX{} Bundle\\}{AcroTeX Bundle:} Testing Form Creation}
\author{D. P. Story}
\subject{File to test web and exerquiz packages}
\keywords{LaTeX, hyperref, PDF, exercises, quizzes}

\university{THE UNIVERSITY OF AKRON\\
   Theoretical and Applied Mathematics}
\email{dpstory@uakron.edu}
\version{1.0}\copyrightyears{\the\year}

\textBgColor{cornsilk}

% Globally change defaults of widgets
\everyListBox{\BC{1 0 0}\BG{0.98 0.92 0.73}}
\everyComboBox{\BC{1 0 0}\BG{0.98 0.92 0.73}}
\everyCheckBox{\BC{1 0 0}\BG{0.98 0.92 0.73}}
\everyRadioButton{\BC{1 0 0}\BG{0.98 0.92 0.73}}
\everyTextField{\BC{1 0 0}\BG{0.98 0.92 0.73}}

\makeatletter
\let\web@copyright=\@gobble
\let\web@revision =\@gobble
\makeatother

% Note: The techniques that follow assume you have folder level JavaScript
% with the following script contained in it. Install the file myJS.js
% which accompanies the distribution in the User JavaScript folder
%
\begin{execJS}{execjs}
function importMyIcons ()
{
   this.importIcon("buttonN", "graphics/button.pdf", 0);
   this.importIcon("arrowR","graphics/button.pdf", 1);
   this.importIcon("arrowP","graphics/button.pdf", 2);
}
_MenuProc = importMyIcons;
app.execMenuItem("MenuProc");
_MenuProc = function() {;}
var f = this.getField("Arrows");
f.buttonPosition = position.iconOnly;
var i = this.getIcon("buttonN");
f.buttonSetIcon(i,0);
i = this.getIcon("arrowP");
f.buttonSetIcon(i,1);
i = this.getIcon("arrowR");
f.buttonSetIcon(i,2);
app.execMenuItem("Save");
\end{execJS}

\begin{defineJS}{\customCkAction}
if (event.target.value == "Off") this.resetForm();
else
{
    var resp = app.alert({
        cMsg: "Are you sure you want to reset the forms?\\r\\rIf you answer 'Yes', click the button again, please.",
        nIcon: 2,
        nType: 2,
    });
    if ( resp == 3 ) event.target.value = "Off";
}
\end{defineJS}



\parindent0pt

\begin{document}

\maketitle

\section{Introduction}

This file is really meant for people who use Acrobat 5.0 or later and create PDF documents using
the Acrobat Distiller.  For those who use \textsf{pdftex} or \textsf{dvipdfm}, see the companion
document \texttt{eqforms\_pd.tex}.

This document contains examples of constructing the various types of form fields: choice fields,
(list box, combo box), button fields (push button, check box, radio button) and text fields. In the section
on text fields, there is a comb field defined, this is a feature of Acrobat 6.0, if you are using Acrobat 5.0,
the combs will not appear.

\medskip\noindent
The documentation for form fields can be found in the document \texttt{eformman.pdf}.


\section{Choice Fields}

\subsection{List Box}

%
% List box with the export values explicitly given
%
List Box: \listBox[\autoCenter{n}\DV{1}\V{1}\Ff\FfSort
      \AA{\AAKeystroke{%
        if(!event.willCommit)app.alert(%
        "You chose \\"" + event.change\r\t
          + "\\""+", which has an export value of "
          + event.changeEx);}}]{myList}{1in}{55bp}
    {[(1)(Socks)][(2)(Shoes)][(3)(Pants)][(4)(Shirt)][(5)(Tie)]}\qquad
%
% List box with export value the same as the face value
%
List Box: \listBox[\Ff\FfCommitOnSelChange\autoCenter{n}\DV{Socks}\V{Socks}\Ff\FfMultiSelect]
    {myList1}{1in}{55bp}{(Socks)(Shoes)(Pants)(Shirt)(Tie)}

\subsection{Combo Box}

Combo Box: \comboBox[\DV{1}\V{1}\Ff\FfSort\Ff\FfCommitOnSelChange\F{-\FPrint}\BC{}]
    {myCombo}{1in}{10bp}{ [(1)(Socks)][(2)(Shoes)]
    [(3)(Pants)][(4)(Shirt)][(5)(Tie)][(6)(Belt)][(7)(Shorts)]}

\section{Button Fields}

\subsection{Pushbuttons}

Push Button \pushButton[\CA{Push}\AC{Me}\RC{Reset}\A{/S /ResetForm}]
    {myButton}{30bp}{15bp}\quad
%
Push Button \pushButton[\H{P}\S{S}\BC{}\BG{}]{Arrows}{20bp}{20bp}\vspace{1bp}\vspace{3bp}

Push Button \pushButton[\S{S}\W{0}\BC{0 0 0}
         \mkIns{/I {eCalc} /RI {reCalc} /IX {peCalc} /TP 1 /IF << /SW /A /S /A /A [0.0 0.0] >>}
    ]
    {eCalculus1}{80bp}{20bp}\vspace{3bp}\quad
%
Push Button \smash[t]{\raisebox{36pt}{\pushButton[\S{S}\W{0}\BC{0 0 0}\R{90}
         \mkIns{/I {eCalc} /RI {reCalc} /IX {peCalc} /TP 1 /IF << /SW /A /S /A /A [0.0 0.0] >>}
    ]
    {eCalculus2}{20bp}{80bp}\vspace{3bp}}}

Push Button \pushButton[\S{B}\W{1}\BC{}
         \mkIns{/I {eCalc} /RI {reCalc} /IX {peCalc} /TP 1 /IF << /SW /A /S /P /A [0.0 0.0] >>}
    ]
    {eCalculus3}{60bp}{20bp}\vspace{3bp}\quad
%
Push Button \pushButton
    [
        \S{S}\W{1}\BC{}\BG{}\CA{Calculus}\AC{Calculus}\RC{Calculus}\textSize{6}\textColor{0 0 1}
         \mkIns{/I {eCalc} /RI {reCalc} /IX {peCalc} /TP 2 /IF << /SW /A /S /P /A [0.0 0.0] >>}
    ]
    {eCalculus4}{60bp}{30bp}%\vspace{3bp}


\subsection{Radio Buttons}

Radio Button: \radioButton[\Ff{\FfNoToggleToOff}]{myRadio1}{10bp}{10bp}{V1}
              \radioButton{myRadio1}{10bp}{10bp}{V1}
              \radioButton[\symbolchoice{square}]{myRadio1}{10bp}{10bp}{V2}
%
\kern3bp
Radio Button: \radioButton[\Ff\FfRadiosInUnison\textColor{0 0 1 rg}]{myRadio2}{10bp}{10bp}{V1}
              \radioButton[\textColor{1 0 0 rg}]{myRadio2}{10bp}{10bp}{V1}
              \radioButton[\symbolchoice{star}\textColor{0 .6 0 rg}]{myRadio2}{10bp}{10bp}{V2}


\subsection{Checkboxes}

Check Box:    \checkBox[\DV{V1}\V{V1}]{myCheck1}{10bp}{10bp}{V1}
              \checkBox{myCheck1}{10bp}{10bp}{V1}
              \checkBox[\symbolchoice{square}]{myCheck2}{10bp}{10bp}{V2}


% AS = appearance state when the widget is first rendered
% V = the current value of the widget
% DV = the value of the widget when reset

Custom Appearance Check Box: \checkBox
                                 [\MK{}\F\FLock\V{Off}\DV{Off}\AS{Off}
                                  \A{\JS{\customCkAction}}
                                  \AP{/N << /On {xO} /Off {xX} >> }
                                 ]{CusCk}{10bp}{10bp}{On}

\section{Text Fields}
%
\makebox[0pt][l]{Text Field:}\phantom{Comb Field:}\
    \textField[\MaxLen{20}\V{Enter Name: }\DV{Enter Name: }]{myText}{1.5in}{12bp}\quad
%
Text Field: \smash[b]{\raisebox{-1.5in + \baselineskip}{\textField
    [\autoCenter{n}
     \R{270}
     \V{Enter Address: }
     \DV{Enter Address: }
     \Ff\FfMultiline
    ]{mymultiText}{5\baselineskip}{1.5in}}}

\kern3pt
Comb Field:\ \textField[\Ff{\FfComb}\MaxLen{10}]{myCombText}{1.5in}{12bp}

%------------------- Postscript insertions -------------------------%

\def\fontsize{64 }
\def\offsetX{15 }

%
% This is a work around for a problem with hyperref. When you view a file compiled with
% hyperref with forms, a submit button appears when you look at the Postscript document
% using GSView, and this submit button prints to a postscript printer. The following
% code solves that problem
%
\special{!%
      /product where{%
        pop
        product(Distiller)search{%
          pop pop pop
          userdict
          /?pdfmark /exec load put%
        }{%
        pop
        userdict
            begin
            /?pdfmark /pop load def
            end
        }ifelse%
      }if%
}

\special{! % Normal Appearance
[/BBox [0 0 400 100] /_objdef {eCalc} /BP pdfmark
{0 0 .5 setrgbcolor 0 0 400 100 rectfill 1 setgray 2 2 moveto
2 98 lineto 398 98 lineto 396 96 lineto 4 96 lineto 4 4 lineto fill
0.34 setgray 398 98 moveto 398 2 lineto 2 2 lineto 4 4 lineto
396 4 lineto 396 96 lineto fill /Viva-Regular \fontsize selectfont
1 0 0 setrgbcolor \offsetX 22.5 moveto (e\string\-Calculus) show} ?pdfmark
[/EP pdfmark}

\special{! % Rollover Appearance
[/BBox [0 0 400 100] /_objdef {reCalc} /BP pdfmark
{0 0 1 setrgbcolor 0 0 400 100 rectfill 1 setgray 2 2 moveto
2 98 lineto 398 98 lineto 396 96 lineto 4 96 lineto 4 4 lineto fill
0.34 setgray 398 98 moveto 398 2 lineto 2 2 lineto 4 4 lineto
396 4 lineto 396 96 lineto fill /Viva-Regular \fontsize selectfont
1 0 0 setrgbcolor \offsetX 22.5 moveto (e\string\-Calculus) show} ?pdfmark
[/EP pdfmark}

\special{! %Pushed Appearance
[/BBox [0 0 400 100] /_objdef {peCalc} /BP pdfmark
{0 0 1 setrgbcolor 0 0 400 100 rectfill 0.34 setgray 2 2 moveto
2 98 lineto 398 98 lineto 396 96 lineto 4 96 lineto 4 4 lineto fill
1 setgray 398 98 moveto 398 2 lineto 2 2 lineto 4 4 lineto
396 4 lineto 396 96 lineto fill /Viva-Regular \fontsize selectfont
1 0 0 setrgbcolor \offsetX 22.5 moveto (e\string\-Calculus) show} ?pdfmark
[/EP pdfmark}

\special{! %The Tic-Tac-Toe "O"
[/BBox [0 0 100 100] /_objdef {xO} /BP pdfmark
{.7529 setgray 0 0 100 100 rectfill 1 setgray
2 2 moveto 2 98 lineto 98 98 lineto 96 96 lineto 4 96 lineto
4 4 lineto fill 0.34 setgray 98 98 moveto 98 2 lineto 2 2 lineto
4 4 lineto 96 4 lineto 96 96 lineto fill 0 setgray 22.5 22.5 moveto
1 0 0 setrgbcolor /Helvetica 72 selectfont (O) show} ?pdfmark
[/EP pdfmark}

\special{! %The Tic-Tac-Toe "X"
[/BBox [0 0 100 100] /_objdef {xX} /BP pdfmark
{.7529 setgray 0 0 100 100 rectfill 1 setgray
2 2 moveto 2 98 lineto 98 98 lineto 96 96 lineto 4 96 lineto
4 4 lineto fill 0.34 setgray 98 98 moveto 98 2 lineto 2 2 lineto
4 4 lineto 96 4 lineto 96 96 lineto fill 0 setgray 27 22.5 moveto
0 0 1 setrgbcolor /Helvetica 72 selectfont (X) show} ?pdfmark
[/EP pdfmark}


\end{document}
