我想检索 hyperref TextField 的值,以便稍后在电子邮件提交中使用。例如:++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
\usepackage{hyperref}
\newdimen\longline
\def\LayoutTextField#1#2{#2} % override default in hyperref
\def\lbl#1{\hbox to 4cm{#1\dotfill\strut}}%
\def\labelline#1#2{\lbl{#1}\vbox{\hbox{\TextField[name=#1,width=#2]{\null}}\kern2pt\hrule}}
\def\q#1{\hbox to \hsize{\labelline{#1}{\longline}}\vskip1.4ex}
\def\DefaultWidthofChoiceMenu{12pt}%
\longline=0.95\textwidth\advance\longline-6em
\newcommand{\hgt}{17\baselineskip}
\newcommand{\nameRUID}{
\TextField[name = Name,
width = 7cm,
borderwidth = 0,
bordersep = 1pt,
backgroundcolor = {.85 .85 .85}]
{Name}
\hskip1ex
%%
\TextField[name = RUID,
width = 2.5cm,
borderwidth = 0,
bordersep = 4pt,
backgroundcolor = {.85 .85 .85}]
{RUID}
\vskip1ex
}
\begin{document}
\renewcommand*{\DefaultHeightofTextMultiline}{6\baselineskip}
\renewcommand*{\LayoutTextField}[2]{\makebox[3.5em][l]{#1:}%
\raisebox{\baselineskip}{\raisebox{-\height}{#2}}}
\begin{Form}[action = mailto:forms <[email protected]>?subject = Midterm Exam for this.getField('Name').value, method = get ]
\nameRUID
\fcolorbox{black}{yellow}{
\mypar
\begin{boxedminipage}{6in}
\begin{center}
{\LARGE \textbf{Click this Button to Submit Your Exam}}
\par\bigskip
{\Large Rename this pdf file to your Last Name and RUID BEFORE submitting. Example: Smith\_1234.pdf}
\par\bigskip
\Submit[export=pdf]{{\large \textbf{Submit}}}
\par\bigskip
\end{center}
\end{boxedminipage}
}
\end{Form}
\newpage
\end{document}
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
我想在电子邮件提交中使用 \nameRUID 命令中的姓名条目。但我不知道该如何操作。有什么建议吗?
谢谢,
沃尔特
答案1
我不熟悉 javascript,但我发现了一个想法这里。我们需要的是创建一个\PushButton
带有选项的onclick
。
\documentclass[french]{article}
\usepackage{xcolor}
\usepackage{hyperref}
\newdimen\longline
\def\LayoutTextField#1#2{#2} % override default in hyperref
\def\lbl#1{\hbox to 4cm{#1\dotfill\strut}}%
\def\labelline#1#2{\lbl{#1}\vbox{\hbox{\TextField[name=#1,width=#2]{\null}}\kern2pt\hrule}}
\def\q#1{\hbox to \hsize{\labelline{#1}{\longline}}\vskip1.4ex}
\def\DefaultWidthofChoiceMenu{12pt}%
\longline=0.95\textwidth\advance\longline-6em
\newcommand{\hgt}{17\baselineskip}
\newcommand{\nameRUID}{
\TextField[name = Name,
width = 7cm,
borderwidth = 0,
bordersep = 1pt,
backgroundcolor = {.85 .85 .85}]
{Name}
\hskip1ex
%%
\TextField[name = RUID,
width = 2.5cm,
borderwidth = 0,
bordersep = 4pt,
backgroundcolor = {.85 .85 .85}]
{RUID}
\vskip1ex
}
\begin{document}
\renewcommand*{\DefaultHeightofTextMultiline}{6\baselineskip}
\renewcommand*{\LayoutTextField}[2]{\makebox[3.5em][l]{#1:}%
\raisebox{\baselineskip}{\raisebox{-\height}{#2}}}
\begin{Form}
\nameRUID
\fcolorbox{black}{yellow}{%
\begin{minipage}{6in}
\begin{center}
{\LARGE \textbf{Click this Button to Submit Your Exam}}
\par\bigskip
{\Large Rename this pdf file to your Last Name and RUID BEFORE submitting. Example: Smith\_1234.pdf}
\par\bigskip
% \Submit{{\large \textbf{Submit}}}
\PushButton[
onclick={var TheSubject = "Midterm Exam for " + this.getField("Name").value;
var mymailto = "mailto:forms <[email protected]>?subject=" + TheSubject;
this.submitForm({cURL: mymailto, cSubmitAs: "PDF" });}]{{\large \textbf{Submit}}}
\par\bigskip
\end{center}
\end{minipage}}
\end{Form}
\newpage
\end{document}