[Tex/LaTex] Making fillable forms in LaTeX using TextField and CheckBox

formshyperrefprinting

This is what I got so far with the code given below.

enter image description here

\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{array}

\makeatletter

\providecommand{\tabularnewline}{\\}

\usepackage{hyperref}

\makeatother

\usepackage{babel}
\begin{document}
\begin{Form}[action=http://your-web-server.com/path/receiveform.cgi]

\begin{tabular}{ll>{\centering}p{0.6cm}ll}
Name: & \TextField[height=0.01cm, width=5cm] &  & Name: & Need TextField here  \tabularnewline
Client's Name: & \TextField[height=0.01cm, width=5cm] &  & Advisor Name: & \rule{5cm}{1pt}\tabularnewline
\end{tabular}

\vspace*{0.3cm}

Have you ? \hfill{} \CheckBox[height=0.01cm, width=0.4cm] \enspace{} Yes
\hfill{} \CheckBox[height=0.01cm, width=0.4cm] \enspace{} No


\Submit{Submit}

\end{Form}
\end{document}

Questions

  1. How to control the height of TextField as two TextFields are overlapping?
  2. How to change color of TextField?
  3. How to make two CheckBoxes mutually exclusive so only one can be checked at once?

An help will be highly appreciated. Thanks

Best Answer

You can change the height of a textfield with the height option or by redefining \DefaultHeightofText. But the minimal height of the field will always be the height of the surrounding box. In a tabular cell (which contains a \strut) this is the height of the cell. If you want to avoid this you can add an additional box:

\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{array}
\usepackage{hyperref}
\usepackage{babel}

\begin{document}
%suppress the label:
\def\LayoutTextField#1#2{% label, field
  #2%
}
\begin{Form}
\def\DefaultHeightofText{5pt}

\mbox{\strut\TextField[width=3cm]{namea}} \mbox{\TextField[width=3cm]{namea}}


\begin{tabular}{ll}
Name: & \mbox{\TextField[width=3cm]{namea}} \\%smaller
Name: & \TextField[width=3cm]{namea}
\end{tabular}


\end{Form}
\end{document}

enter image description here