Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I trying to do underlined TextField with label under the field (hyperref package).

using Underlined text field in a fillable form

i tried to renew MakeTextField:

\renewcommand{\MakeTextField}[2]{{\vbox to #2{\vfill\hbox to #1{\hrulefill}}}}

But before i can see it like underline, i had to insert this code:

\begin{insDLJS}{mydljs}{ }
    this.getField('name').fillColor=color.transparent;
    this.getField('name').borderColor=color.transparent;
\end{insDLJS}

So first questions are:

  1. why i see it like boxes, without javascript code?
  2. i have to insert it's for all fields? Maybe you know have to do it easler?

Then i tried to renew LayoutTextField, best try:

\renewcommand{\LayoutTextField}[2]{%
\vbox to \baselineskip{%
 \hbox to \DefaultWidthofText{\makebox[\width]{#2}}%
 \hbox to \DefaultWidthofText{\hfill\makebox[\width]{#1} \hfill}%
}}

result:

result

And i can't centering it, i can't get width of field and use it when i placing label. questions:

  1. How can i get size of Textfield in LayoutTextField?
  2. How centering label?

i can center it only using ugly

\renewcommand{\LayoutTextField}[2]{%
\begin{tabular}{c}%
\\%
#2  \\%
\hline%
\small{#1}%
\end{tabular}%
}

without \renewcommand{\MakeTextField} , but it's disgusting, and create vertical spaces :(

Then i create textfield to enter date and found 2 problems:

  1. I can't insert russian text using javascript.
  2. I can't to use percent symbol (%) in javascript code in keystroke inside TextField)

First problem i solve using unicode. I wrote small python script to convert text from cp-1251 to unicode, example:

>>> unicode("Январь","cp1251")
u'\u042f\u043d\u0432\u0430\u0440\u044c'

and then insert it into javascript, and it's works :) but it's hard to read and edit this, mb smb known another way?

Second problem i solve using insDLJS (\%) without it problem with backslash (\) and (%). I'm very lazy, and maybe smb know, how i can use it inside keystroke,format,calculate, etc.?

share|improve this question
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.