So I just can't seem to figure this out. In a Latex "Form" environment, imagine having a textfield like the following:
\TextField[default=URL_Here,bordercolor=,name=link1,width=8cm,charsize=10pt]{}
Now, if you want to access this elsewhere in the same Form block, you can do so with:
this.getField("link1").value
But, how can you then convert that to a hyperlink elsewhere? The end goal is to have it so that when a URL is input in one textfield, a clickable link appears in an adjacent field. So far, the following methods all fail:
\href{this.getField("link1").value}{Link}
and
\PushButton[
onclick={
this.submitForm(this.getField("link1").value);
},
name=hlink1,
readonly=false, bordercolor=, width=2cm, charsize=10pt
]{Link}
The first approach simply crashes on pdflatex compilation, and the latter succeeds (only if https:// is specified in the url), but fails as it tries to access some arbitrary url (copied below with my username changed to USERNAME for anonymity):
file:///C:/Users/USERNAME/AppData/Local/Temp/acrord32_sbx/A9Rcopupe_dxvlog_9x4.htm
A minimal test case of the above submit button (that fails) is as follows:
\documentclass{article}
\usepackage{hyperref}
\begin{document}
\begin{Form}
\begin{tabular}{c | c }
\TextField[default=https://www.google.com,bordercolor=,name=link1,width=8cm,charsize=10pt]{} &
\PushButton[
onclick={
this.submitForm(this.getField("link1").value);
},
name=hlink1,
readonly=false, bordercolor=, width=2cm, charsize=10pt
]{Link}
\end{tabular}
\end{Form}
\end{document}