1 #LyX 2.1 created this file. For more info see http://www.lyx.org/
7 % to be able to use custom colors
8 \usepackage[svgnames,rgb]{xcolor}
10 % ------------------------------------
11 % used to check for needed LaTeX packages
14 % check for package insdljs
15 % used for JavScript code
17 \IfFileExists{insdljs.sty}
18 {\usepackage[pdftex]{insdljs}
19 \setboolean{insdljs}{true}}
20 {\setboolean{insdljs}{false}}
22 \pdfcatalog{/AA \the\pdflastobj\space 0 R}
23 \begin{insDLJS}[exaaae]{exaaae}{JavaScript}
25 function validateTime(){
27 if((event.value == "u") || (event.value == "unlimited")) {
28 this.getField("from").display = display.hidden;
29 this.getField("to").display = display.hidden;
31 this.getField("from").display = display.visible;
32 this.getField("to").display = display.visible;
33 this.getField("from").setFocus();
38 function checkNumber() {
40 if (!Number(event.value))
42 app.alert("Value must be a number!");
45 event.target.textColor = color.green;
56 % set fonts for nicer pdf view
57 \IfFileExists{lmodern.sty}
58 {\usepackage{lmodern}}{}
60 \fi % end if pdflatex is used
62 \options BCOR8mm,pagesize
63 \use_default_options false
67 \maintain_unincluded_children false
69 \language_package default
74 \font_typewriter default
76 \font_default_family default
77 \use_non_tex_fonts false
83 \default_output_format default
85 \bibtex_command bibtex
86 \index_command default
90 \pdf_title "Description of the module pdfcomment"
91 \pdf_author "Uwe Stöhr"
92 \pdf_subject "PDF form"
93 \pdf_keywords "LyX, PDF forms, hyperref"
95 \pdf_bookmarksnumbered true
96 \pdf_bookmarksopen true
97 \pdf_bookmarksopenlevel 2
100 \pdf_colorlinks false
102 \pdf_pdfusetitle false
103 \pdf_quoted_options "linkcolor=black, citecolor=black, urlcolor=blue, filecolor=blue, pdfpagelayout=OneColumn, pdfnewwindow=true, pdfstartview=XYZ, plainpages=false, urlbordercolor={1 0 0}"
106 \use_package amsmath 1
107 \use_package amssymb 1
108 \use_package cancel 0
110 \use_package mathdots 1
111 \use_package mathtools 1
112 \use_package mhchem 1
113 \use_package stackrel 0
114 \use_package stmaryrd 0
115 \use_package undertilde 0
117 \cite_engine_type default
121 \paperorientation portrait
125 \notefontcolor #0000ff
132 \paragraph_separation skip
134 \quotes_language english
137 \paperpagestyle default
138 \tracking_changes false
139 \output_changes false
142 \html_be_strict false
147 \begin_layout Begin PDF Form
149 \begin_inset Argument 1
152 \begin_layout Plain Layout
153 action=mailto:forms@lyx.test?subject=The submitted PDF form, method=post
162 Description of the module PDF Form
169 \begin_layout Standard
170 \begin_inset Note Note
173 \begin_layout Plain Layout
174 To export all parts of this document to PDF the LaTeX-package
179 If it is not installed you can export the document anyway but the example
180 in the section about dynamic form fields won't appear in the output.
188 \begin_layout Standard
189 By loading the module PDF
193 Form the whole document or a part of it can be made a PDF form.
194 You can add all possible form elements like text fields buttons etc.
195 This document describes how this is done.
198 \begin_layout Section
200 \begin_inset CommandInset label
202 name "sec:Preparation"
209 \begin_layout Standard
210 At first load the module PDF
214 Form in the document settings of your file.
215 To make the whole document a form, insert the environment
227 from LyX's dropdown menu at the beginning of the document.
228 If only a part of the document should be a form, add
240 at the position where the form should start.
243 \begin_layout Standard
244 \begin_inset Note Greyedout
247 \begin_layout Plain Layout
252 It is only possible to have one form in a PDF file!
260 \begin_layout Standard
261 If the form data should be submitted to a server or the like, then you must
262 specify the URL as parameter of the
275 This is done by using the menu
277 Insert\SpecialChar \menuseparator
289 For example in this document the following was inserted to the parameter
293 \begin_layout Standard
296 action=mailto:forms@lyx.test?subject=The submitted PDF form,
297 \begin_inset Newline newline
303 \begin_layout Standard
304 This sends the form data as email to
308 when the user presses the submit button.
309 The email subject will be
310 \begin_inset Quotes eld
313 The submitted PDF form
314 \begin_inset Quotes erd
317 and the HTML method is
322 (The other possible method would be
326 .) For more about submitting see sec.
327 \begin_inset space \thinspace{}
331 \begin_inset CommandInset ref
333 reference "sub:Submit-button"
340 \begin_layout Standard
341 \begin_inset Newpage newpage
347 \begin_layout Section
351 \begin_layout Standard
356 possible types of fields in a PDF form:
359 \begin_layout Subsection
363 \begin_layout Standard
364 A text field is added by inserting the custom inset
370 Insert\SpecialChar \menuseparator
378 Write inside the inset the label for the text field that will be printed
379 in the PDF output before the field.
381 \begin_inset Newline newline
385 \begin_inset Flex TextField
388 \begin_layout Plain Layout
390 \begin_inset Argument 1
393 \begin_layout Plain Layout
399 Enter your name here:
407 \begin_layout Standard
408 You must also specify a field name for text fields: Set the cursor into
414 There insert for example the parameter
425 \begin_layout Standard
426 \begin_inset Note Greyedout
429 \begin_layout Plain Layout
434 All braces and brackets in form parameters must be inserted as TeX code!
442 \begin_layout Standard
443 Using the same name for several text fields results in an automatic duplication
444 of the inserted text.
445 This is for example useful if the user should input a date that should
446 appear at different places in the form.
447 \begin_inset Newline newline
454 fields as example: Fill one and see that the other one will also be filled
456 \begin_inset Newline newline
460 \begin_inset Flex TextField
463 \begin_layout Plain Layout
465 \begin_inset Argument 1
468 \begin_layout Plain Layout
480 \begin_inset Newline newline
484 \begin_inset Flex TextField
487 \begin_layout Plain Layout
489 \begin_inset Argument 1
492 \begin_layout Plain Layout
506 \begin_layout Standard
507 All form fields can be customized by adding parameters.
510 \begin_layout Standard
511 Here is a customized multiline text field with a width of 60
512 \begin_inset space \thinspace{}
515 % of the text width, 3
516 \begin_inset space \thinspace{}
519 cm height and a proposed content:
520 \begin_inset VSpace defskip
524 \begin_inset Newline newline
528 \begin_inset Flex TextField
531 \begin_layout Plain Layout
533 \begin_inset Argument 1
536 \begin_layout Plain Layout
537 name=customer2, multiline, width=0.6
539 textwidth, height=3cm, value={Testman}
544 Enter your name here:
552 \begin_layout Standard
553 \begin_inset Note Greyedout
556 \begin_layout Plain Layout
561 It is highly recommended to use a uniform layout of all fields in your
564 \begin_inset space \thinspace{}
568 \begin_inset CommandInset ref
570 reference "sec:Form-field-customization"
574 for how this is done.
582 \begin_layout Subsection
586 \begin_layout Standard
587 A check box is added by inserting the custom inset
592 Write inside the inset the label for the box.
594 \begin_inset Newline newline
598 \begin_inset Flex CheckBox
601 \begin_layout Plain Layout
603 \begin_inset Argument 1
606 \begin_layout Plain Layout
612 Are you older than 18 years?
620 \begin_layout Standard
621 You must also specify a field name for check boxes: Insert for example the
630 is the field name) into the
637 \begin_layout Subsection
641 \begin_layout Standard
642 A choice menu is added by inserting the custom inset
647 A label for the inset is added by using the menu
649 Insert\SpecialChar \menuseparator
653 Insert the label text into this inset.
654 \begin_inset Newline newline
657 The different choices are inserted to the inset as comma-separated list.
665 \begin_layout Description
666 Radio Only one choice can be selected
669 \begin_layout Description
670 Combo The choices are listed in a combo box (dropdown list) but the user
671 is allowed to choose something that is not in the predefined list.
674 \begin_layout Description
675 Popdown All choices are listed below each other.
676 It the filed is not high enough a scroll bar is automatically added to
680 \begin_layout Standard
681 To determine the choice menu type, add the parameter
696 \begin_layout Standard
697 Here is an example for the radio type:
698 \begin_inset VSpace defskip
702 \begin_inset Newline newline
706 \begin_inset Flex ChoiceMenu
709 \begin_layout Plain Layout
711 \begin_inset Argument 1
714 \begin_layout Plain Layout
721 \begin_inset Argument 2
724 \begin_layout Plain Layout
738 \begin_layout Standard
739 Here is an example for the combo type:
740 \begin_inset VSpace defskip
744 \begin_inset Newline newline
748 \begin_inset Flex ChoiceMenu
751 \begin_layout Plain Layout
753 \begin_inset Argument 1
756 \begin_layout Plain Layout
762 Albania=Al, Armenia=Ar, Azerbaidschan=Az
763 \begin_inset Argument 2
766 \begin_layout Plain Layout
780 \begin_layout Standard
781 Here is an example for the popdown type:
782 \begin_inset VSpace defskip
786 \begin_inset Newline newline
790 \begin_inset Flex ChoiceMenu
793 \begin_layout Plain Layout
795 \begin_inset Argument 1
798 \begin_layout Plain Layout
799 popdown, name=country
804 Albania=Al, Armenia=Ar, Azerbaidschan=Az
805 \begin_inset Argument 2
808 \begin_layout Plain Layout
822 \begin_layout Standard
823 You must also specify a field name for choice menus: Insert for example
832 is the field name) into the
839 \begin_layout Standard
840 It is recommended to add a short name for every choice to be able to access
841 them and to know which one was chosen by the user.
842 This is done by adding
846 behind each choice (where
851 For example the radio type example contains this choice list:
857 \begin_inset Quotes eld
861 \begin_inset Quotes erd
864 you know that he chose the choice
865 \begin_inset Quotes eld
869 \begin_inset Quotes erd
873 By specifying names you can also preset/propose e.g.
874 \begin_inset space \space{}
878 \begin_inset Quotes eld
882 \begin_inset Quotes erd
885 by adding the parameter
893 \begin_layout Standard
894 \begin_inset Flex ChoiceMenu
897 \begin_layout Plain Layout
899 \begin_inset Argument 1
902 \begin_layout Plain Layout
903 radio, name=sex, default=m
909 \begin_inset Argument 2
912 \begin_layout Plain Layout
926 \begin_layout Standard
927 \begin_inset Note Greyedout
930 \begin_layout Plain Layout
935 Due to a bug in the LaTeX package
939 it is currently only possible the set the first choice as default.
947 \begin_layout Standard
948 \begin_inset Newpage newpage
954 \begin_layout Subsection
958 \begin_layout Standard
959 A push button is added by inserting the custom inset
964 Write inside the inset the label for the button.
968 \begin_layout Standard
969 \begin_inset Flex PushButton
972 \begin_layout Plain Layout
974 \begin_inset Argument 1
977 \begin_layout Plain Layout
983 Don't click on this button or your fridge will be destroyed!!!
991 \begin_layout Standard
992 The action that is triggered by pressing the button is specified by JavaScript
994 To specify it, add the parameter
998 and insert the JavaScript code between the braces.
1001 \begin_layout Standard
1002 \begin_inset Flex PushButton
1005 \begin_layout Plain Layout
1007 \begin_inset Argument 1
1010 \begin_layout Plain Layout
1011 onclick={app.alert("What the hell? Now you destroyed your fridge.
1017 Don't click on this button or your fridge will be destroyed!!!
1025 \begin_layout Standard
1026 For info about JavaScript, see its documentation,
1027 \begin_inset CommandInset citation
1036 \begin_layout Standard
1037 A common usage for pus buttons is to open a weblink.
1038 Such a button is created by inserting the command
1044 into the button inset.
1051 is used in the scheme
1052 \begin_inset Newline newline
1059 href{link target}{text}
1062 \begin_layout Standard
1063 In the following button this code was used:
1064 \begin_inset Newline newline
1071 href{http://wiki.lyx.org}{Information how to fill out this form}
1074 \begin_layout Standard
1075 \begin_inset Flex PushButton
1078 \begin_layout Plain Layout
1080 \begin_inset Argument 1
1083 \begin_layout Plain Layout
1091 href{http://wiki.lyx.org}{Information how to fill out this form}
1099 \begin_layout Standard
1100 To get rid of the frame for weblinks add this to the additional options
1101 in the document settings under
1104 \begin_inset space ~
1112 \begin_layout Standard
1115 urlbordercolor={1 0 0}
1118 \begin_layout Standard
1119 if your push button border color is red (the default), otherwise use the
1120 same color definition as for your push button border color.
1123 \begin_layout Subsection
1125 \begin_inset CommandInset label
1127 name "sub:Submit-button"
1134 \begin_layout Standard
1135 A submit button is used to submit the form data to a server.
1136 It is added by inserting the custom inset
1141 Write inside the inset the label for the button.
1145 \begin_layout Standard
1146 \begin_inset Flex SubmitButton
1149 \begin_layout Plain Layout
1151 \begin_inset Argument 1
1154 \begin_layout Plain Layout
1160 Send your data via email
1168 \begin_layout Standard
1169 The submit button creates a forms data format (FDF) file (file extension
1170 *.fdf) which is then submitted.
1171 The FDF file contains only the form data.
1172 They can only be applied to a PDF form if all fields in the form have a
1176 \begin_layout Standard
1177 \begin_inset Note Greyedout
1180 \begin_layout Plain Layout
1185 You can only use a submit button if you specified the submit method and
1186 target in the PDF form environment options! See sec.
1187 \begin_inset space \thinspace{}
1191 \begin_inset CommandInset ref
1193 reference "sec:Preparation"
1197 for the description.
1198 If there are no specifications you will get LaTeX errors!
1206 \begin_layout Standard
1207 \begin_inset Note Greyedout
1210 \begin_layout Plain Layout
1215 If you have more than one submit button in your document you must specify
1216 a name for each of them to avoid LaTeX errors! For example add
1224 is the button name).
1232 \begin_layout Subsection
1236 \begin_layout Standard
1237 A reset button is used to reset all form fields to the initial state.
1238 It is added by inserting the custom inset
1243 Write inside the inset the label for the button.
1247 \begin_layout Standard
1248 \begin_inset Flex ResetButton
1251 \begin_layout Plain Layout
1253 \begin_inset Argument 1
1256 \begin_layout Plain Layout
1270 \begin_layout Standard
1271 \begin_inset Note Greyedout
1274 \begin_layout Plain Layout
1279 If you have more than one reset button in your document you must specify
1280 a name for each of them to avoid LaTeX errors! For example add
1288 is the button name).
1296 \begin_layout Section
1297 Form field customization
1298 \begin_inset CommandInset label
1300 name "sec:Form-field-customization"
1307 \begin_layout Standard
1308 Since all form elements should look uniform, one can determine their layout
1309 using the following styles:
1312 \begin_layout Description
1314 \begin_inset space ~
1318 \begin_inset space ~
1324 \begin_layout Description
1326 \begin_inset space ~
1330 \begin_inset space ~
1336 \begin_layout Description
1338 \begin_inset space ~
1342 \begin_inset space ~
1345 Style affects all choice menu types
1348 \begin_layout Description
1350 \begin_inset space ~
1354 \begin_inset space ~
1357 Style affects only the combo box style
1360 \begin_layout Description
1362 \begin_inset space ~
1366 \begin_inset space ~
1369 Style affects only the popdown box style
1372 \begin_layout Description
1374 \begin_inset space ~
1378 \begin_inset space ~
1381 Style affects only the radio box style
1384 \begin_layout Description
1386 \begin_inset space ~
1390 \begin_inset space ~
1396 \begin_layout Description
1398 \begin_inset space ~
1402 \begin_inset space ~
1408 \begin_layout Description
1410 \begin_inset space ~
1414 \begin_inset space ~
1420 \begin_layout Text Field Style
1424 \begin_layout Standard
1425 The content of the styles is a comma-separated list of parameters.
1426 The possible parameters are listed in sec.
1427 \begin_inset space \thinspace{}
1431 \begin_inset Quotes eld
1434 Forms optional parameters
1435 \begin_inset Quotes erd
1438 of the documentation of the LaTeX package
1443 \begin_inset CommandInset citation
1450 It is important that the parameter print is always part of the definition,
1451 otherwise the fields won't appear in the PDF output.
1452 The defined style is applied to all fields following the definition.
1455 \begin_layout Subsubsection*
1456 Here are some examples:
1459 \begin_layout Text Field Style
1461 print, bordercolor=red, borderstyle=U, backgroundcolor=lightgray, color=lime,
1462 maxlen=10, align=2, charsize=16pt
1465 \begin_layout Check Box Style
1467 print, borderstyle=S, checkboxsymbol=
1472 \begin_layout Combo Box Style
1474 print, bordercolor={0.33 0.66 0.33}, borderstyle=D
1477 \begin_layout Popdown Box Style
1482 \begin_layout Radio Box Style
1484 print, borderstyle=I, radiosymbol=6
1487 \begin_layout Push Button Style
1489 print, borderstyle=B, bordercolor=lime
1492 \begin_layout Submit Button Style
1494 print, borderwidth=0, bordercolor=white
1497 \begin_layout Reset Button Style
1499 print, bordercolor=lime
1502 \begin_layout Itemize
1503 Text field with gray background, lime text color, a red border only below
1504 the field, right alignment, 16
1505 \begin_inset space \thinspace{}
1508 pt font size and a limitation for maximal 10
1509 \begin_inset space ~
1512 characters to insert:
1513 \begin_inset VSpace defskip
1517 \begin_inset Newline newline
1521 \begin_inset Flex TextField
1524 \begin_layout Plain Layout
1526 \begin_inset Argument 1
1529 \begin_layout Plain Layout
1535 Enter your name here:
1543 \begin_layout Standard
1571 \begin_layout Standard
1572 \begin_inset Note Greyedout
1575 \begin_layout Plain Layout
1584 has only an effect for text fields if a
1596 \begin_layout Itemize
1597 Check box with normal border and symbol
1600 \begin_inset VSpace defskip
1604 \begin_inset Newline newline
1608 \begin_inset Flex CheckBox
1611 \begin_layout Plain Layout
1613 \begin_inset Argument 1
1616 \begin_layout Plain Layout
1622 Are you older than 18 years?
1630 \begin_layout Standard
1631 The symbol is either specified as number or with the command
1632 \begin_inset Newline newline
1642 \begin_inset Newline newline
1649 is one of the possible numbers listed in Table
1650 \begin_inset space ~
1654 \begin_inset CommandInset citation
1663 \begin_layout Itemize
1664 Combo box with dashed, colored border:
1665 \begin_inset VSpace defskip
1669 \begin_inset Newline newline
1673 \begin_inset Flex ChoiceMenu
1676 \begin_layout Plain Layout
1678 \begin_inset Argument 1
1681 \begin_layout Plain Layout
1682 combo, name=combo2, default=Az
1687 Albania=Al, Armenia=Ar, Azerbaidschan=Az
1688 \begin_inset Argument 2
1691 \begin_layout Plain Layout
1705 \begin_layout Itemize
1706 Popdown box where only 2
1707 \begin_inset space ~
1710 entries are shown and where the last entry is preselected:
1711 \begin_inset VSpace defskip
1715 \begin_inset Newline newline
1719 \begin_inset Flex ChoiceMenu
1722 \begin_layout Plain Layout
1724 \begin_inset Argument 1
1727 \begin_layout Plain Layout
1728 popdown, name=country2, value=Az
1733 Albania=Al, Armenia=Ar, Azerbaidschan=Az
1734 \begin_inset Argument 2
1737 \begin_layout Plain Layout
1751 \begin_layout Standard
1752 \begin_inset VSpace defskip
1756 \begin_inset Note Greyedout
1759 \begin_layout Plain Layout
1776 has no effect for popdown boxes.
1784 \begin_layout Itemize
1785 Radio box with inverted bevel border and symbol number
1786 \begin_inset space ~
1790 \begin_inset VSpace defskip
1794 \begin_inset Newline newline
1798 \begin_inset Flex ChoiceMenu
1801 \begin_layout Plain Layout
1803 \begin_inset Argument 1
1806 \begin_layout Plain Layout
1813 \begin_inset Argument 2
1816 \begin_layout Plain Layout
1830 \begin_layout Itemize
1831 Push button with a bevel border and colored text:
1832 \begin_inset VSpace defskip
1836 \begin_inset Newline newline
1840 \begin_inset Flex PushButton
1843 \begin_layout Plain Layout
1845 \begin_inset Argument 1
1848 \begin_layout Plain Layout
1849 onclick={app.alert("Why do you click this?")}
1858 textcolor{red}{Don't click on this button!!!}}
1866 \begin_layout Standard
1867 \begin_inset VSpace defskip
1871 \begin_inset Note Greyedout
1874 \begin_layout Plain Layout
1887 has no effect for push, submit and reset buttons.
1895 \begin_layout Standard
1896 As workaround use the command
1902 as described in sec.
1903 \begin_inset space \thinspace{}
1907 \begin_inset Quotes eld
1911 \begin_inset Quotes erd
1924 that is used is used in the scheme
1925 \begin_inset Newline newline
1932 textcolor{color}{characters to color}
1935 \begin_inset Newline newline
1938 In the button above this code was used:
1939 \begin_inset Newline newline
1948 textcolor{red}{Don't click on this button!!!}}
1951 \begin_layout Standard
1952 \begin_inset Note Greyedout
1955 \begin_layout Plain Layout
1968 has no effect for push, submit and reset buttons.
1976 \begin_layout Standard
1977 As workaround use the box method described in sec.
1978 \begin_inset space \thinspace{}
1982 \begin_inset CommandInset ref
1984 reference "sub:Action-button-customization"
1991 \begin_layout Itemize
1992 Submit button without border, with cyan background color and increased height:
1993 \begin_inset VSpace defskip
1997 \begin_inset Newline newline
2001 \begin_inset Flex SubmitButton
2004 \begin_layout Plain Layout
2006 \begin_inset Argument 1
2009 \begin_layout Plain Layout
2023 centering Send your data via mail}}
2029 \begin_inset VSpace bigskip
2035 \begin_layout Itemize
2036 Reset button with a width of 7
2037 \begin_inset space \thinspace{}
2041 \begin_inset VSpace defskip
2045 \begin_inset Newline newline
2049 \begin_inset Flex ResetButton
2052 \begin_layout Plain Layout
2054 \begin_inset Argument 1
2057 \begin_layout Plain Layout
2065 makebox[7cm]{Reset the form}
2073 \begin_layout Section
2074 PDF viewer action buttons
2077 \begin_layout Standard
2078 One often needs basic actions to be done by the PDF viewer program.
2079 For example to print the form.
2080 Such PDF program-specific actions can be triggered by adding inserting
2086 The PDF viewer programs
2094 can handle all possible actions while other PDF viewers might only support
2096 However, all PDF viewer programs support the basic things like printing,
2098 \begin_inset space ~
2101 as, view in fullscreen etc..
2104 \begin_layout Standard
2105 To specify the action insert its name to the
2110 A list with possible actions can be found in sec.
2111 \begin_inset space \thinspace{}
2115 \begin_inset Quotes eld
2118 Acrobat-specific behavior
2119 \begin_inset Quotes erd
2122 of the documentation of the LaTeX package
2127 \begin_inset CommandInset citation
2136 \begin_layout Standard
2137 Here are some examples:
2140 \begin_layout Description
2142 \begin_inset Flex PDFAction
2145 \begin_layout Plain Layout
2147 \begin_inset Argument 1
2150 \begin_layout Plain Layout
2164 \begin_layout Description
2166 \begin_inset space ~
2170 \begin_inset Flex PDFAction
2173 \begin_layout Plain Layout
2175 \begin_inset Argument 1
2178 \begin_layout Plain Layout
2192 \begin_layout Description
2194 \begin_inset space ~
2198 \begin_inset space ~
2202 \begin_inset Flex PDFAction
2205 \begin_layout Plain Layout
2207 \begin_inset Argument 1
2210 \begin_layout Plain Layout
2216 View the form in fullscreen
2224 \begin_layout Subsection
2225 Action button customization
2226 \begin_inset CommandInset label
2228 name "sub:Action-button-customization"
2235 \begin_layout Standard
2236 Customizing the action buttons requires some complicated LaTeX code because
2237 things like the width, height and border separation cannot be specified
2238 as button parameters.
2241 \begin_layout Standard
2242 The easiest way to customize the buttons is to fill it with a custom box:
2245 \begin_layout Enumerate
2246 Create a normal LyX box of your choice
2249 \begin_layout Enumerate
2252 View\SpecialChar \menuseparator
2254 \begin_inset space ~
2259 to show the source code window (if not already shown)
2262 \begin_layout Enumerate
2263 set the cursor into the box and copy the corresponding LaTeX code from the
2267 \begin_layout Enumerate
2268 paste it t the content of the
2275 \begin_layout Standard
2276 For example the button should be 4
2277 \begin_inset space \thinspace{}
2280 cm wide and have the height of 2 lines.
2281 Then create this parbox:
2282 \begin_inset Newline newline
2286 \begin_inset Box Frameless
2296 height_special "totalheight"
2299 \begin_layout Plain Layout
2307 \begin_inset Newline newline
2310 and copy its LaTeX code to the button
2315 To center the text in the button add
2317 centering right before the button text.
2321 \begin_layout Standard
2322 \begin_inset Flex PDFAction
2325 \begin_layout Plain Layout
2327 \begin_inset Argument 1
2330 \begin_layout Plain Layout
2342 centering Save form as}
2350 \begin_layout Standard
2351 To customize the border color, add the command
2353 menubordercolor={r g b}
2355 to the additional options in the document settings under
2358 \begin_inset space ~
2375 with a number between 0 and 1 for the colors red, green and blue.
2376 If you want to change the border color only for certain buttons, use the
2380 \begin_inset space ~
2384 \begin_inset space ~
2389 before the button and insert there the command
2394 The default value of
2405 \begin_layout PDF Link Setup
2407 menubordercolor={0.1 0.9 0.5}
2410 \begin_layout Standard
2413 menubordercolor={0.1 0.9 0.5}
2416 \begin_inset Newline newline
2420 \begin_inset Flex PDFAction
2423 \begin_layout Plain Layout
2425 \begin_inset Argument 1
2428 \begin_layout Plain Layout
2440 centering Save form as}
2448 \begin_layout Standard
2449 To change the border width use the command
2457 is the width in pixels.
2458 The default value of
2469 \begin_layout Standard
2470 \begin_inset Note Greyedout
2473 \begin_layout Plain Layout
2482 affects all link types, not only the menu links.
2490 \begin_layout PDF Link Setup
2492 pdfborder={0 0 4}, menubordercolor={1 1 0}
2495 \begin_layout Standard
2497 \begin_inset space ~
2500 pixel thick yellow border:
2501 \begin_inset Newline newline
2505 \begin_inset Flex PDFAction
2508 \begin_layout Plain Layout
2510 \begin_inset Argument 1
2513 \begin_layout Plain Layout
2525 centering Save form as}
2533 \begin_layout Standard
2534 To change the background color insert the command
2540 at the beginning of the button inset and a
2549 is hereby the name of the color as described in sec.
2550 \begin_inset space \thinspace{}
2554 \begin_inset Quotes eld
2558 \begin_inset Quotes erd
2568 \begin_layout PDF Link Setup
2573 \begin_layout Standard
2574 An example without a border and with a background color:
2575 \begin_inset Newline newline
2579 \begin_inset Flex PDFAction
2582 \begin_layout Plain Layout
2584 \begin_inset Argument 1
2587 \begin_layout Plain Layout
2601 centering Save form as}}
2609 \begin_layout PDF Link Setup
2611 pdfborder={0 0 1}, menubordercolor={1 0 0}
2614 \begin_layout Section
2618 \begin_layout Standard
2619 It is also possible to have dynamic form fields.
2620 This means that depending on the actions of the user fields can (dis)appear
2621 or change their appearance.
2622 To use this feature, add these lines to your document preamble:
2625 \begin_layout Standard
2630 usepackage[pdftex]{insdljs}
2631 \begin_inset Newline newline
2645 \begin_layout Standard
2646 Then add the necessary JavaScript code to your document LaTeX preamble or
2647 as TeX code to your document.
2648 For info about JavaScript, see its documentation,
2649 \begin_inset CommandInset citation
2658 \begin_layout Standard
2662 \begin_layout Plain Layout
2672 \begin_inset Note Note
2675 \begin_layout Plain Layout
2676 The following section will only be displayed when the LaTeX package
2688 \begin_layout Standard
2689 For the following choice menu this JavaScript code was used:
2692 \begin_layout Standard
2693 \begin_inset listings
2694 lstparams "language=TeX"
2698 \begin_layout Plain Layout
2702 begin{insDLJS}[exaaae]{exaaae}{JavaScript}
2705 \begin_layout Plain Layout
2707 function validateTime(){
2710 \begin_layout Plain Layout
2715 \begin_layout Plain Layout
2717 if((event.value == "u") || (event.value == "unlimited")) {
2720 \begin_layout Plain Layout
2722 this.getField("from").display = display.hidden;
2725 \begin_layout Plain Layout
2727 this.getField("to").display = display.hidden;
2730 \begin_layout Plain Layout
2735 \begin_layout Plain Layout
2737 this.getField("from").display = display.visible;
2740 \begin_layout Plain Layout
2742 this.getField("to").display = display.visible;
2745 \begin_layout Plain Layout
2747 this.getField("from").setFocus();
2750 \begin_layout Plain Layout
2755 \begin_layout Plain Layout
2760 \begin_layout Plain Layout
2765 \begin_layout Plain Layout
2777 \begin_layout Standard
2778 \begin_inset Note Greyedout
2781 \begin_layout Plain Layout
2790 JavaScript funtions must be inserted into the same
2802 \begin_layout Standard
2806 \begin_inset space ~
2810 \begin_inset space ~
2815 of the following choice menu are
2816 \begin_inset Newline newline
2821 name=contract,radio,default=tl,validate={validateTime();}
2824 \begin_layout Standard
2825 \begin_inset Flex ChoiceMenu
2828 \begin_layout Plain Layout
2830 \begin_inset Argument 1
2833 \begin_layout Plain Layout
2834 name=contract,radio,default=tl,validate={validateTime();}
2839 term-limited=tl, unlimited=u
2840 \begin_inset Argument 2
2843 \begin_layout Plain Layout
2855 \begin_inset VSpace defskip
2861 \begin_layout Standard
2862 \begin_inset Tabular
2863 <lyxtabular version="3" rows="3" columns="2">
2864 <features rotate="0" tabularvalignment="middle">
2865 <column alignment="left" valignment="top">
2866 <column alignment="center" valignment="top">
2868 <cell alignment="left" valignment="top" usebox="none">
2871 \begin_layout Plain Layout
2877 <cell alignment="center" valignment="top" usebox="none">
2880 \begin_layout Plain Layout
2881 \begin_inset Flex TextField
2884 \begin_layout Plain Layout
2886 \begin_inset Argument 1
2889 \begin_layout Plain Layout
2890 name=from,width=10em
2907 <cell alignment="center" valignment="top" usebox="none">
2910 \begin_layout Plain Layout
2916 <cell alignment="center" valignment="top" usebox="none">
2919 \begin_layout Plain Layout
2920 \begin_inset VSpace -1.5mm
2930 <cell alignment="left" valignment="top" usebox="none">
2933 \begin_layout Plain Layout
2939 <cell alignment="center" valignment="top" usebox="none">
2942 \begin_layout Plain Layout
2943 \begin_inset Flex TextField
2946 \begin_layout Plain Layout
2948 \begin_inset Argument 1
2951 \begin_layout Plain Layout
2975 \begin_layout Standard
2976 \begin_inset VSpace bigskip
2982 \begin_layout Standard
2983 To check and assure that the user only enters a number to a text field you
2984 can for example use this JavaScript code:
2987 \begin_layout Standard
2988 \begin_inset listings
2989 lstparams "language=TeX"
2993 \begin_layout Plain Layout
2995 function checkNumber() {
2998 \begin_layout Plain Layout
3003 \begin_layout Plain Layout
3005 if (!Number(event.value)) {
3008 \begin_layout Plain Layout
3010 app.alert("Value must be a number!");
3013 \begin_layout Plain Layout
3018 \begin_layout Plain Layout
3023 \begin_layout Plain Layout
3025 event.target.textColor = color.green;
3028 \begin_layout Plain Layout
3038 \begin_layout Standard
3039 An example text field:
3040 \begin_inset Flex TextField
3043 \begin_layout Plain Layout
3045 \begin_inset Argument 1
3048 \begin_layout Plain Layout
3049 name=onlyNumbers, align=1, validate={checkNumber();}
3062 \begin_layout Standard
3066 \begin_layout Plain Layout
3076 \begin_inset Note Note
3079 \begin_layout Plain Layout
3080 The following will be displayed when the LaTeX package
3092 \begin_layout Standard
3093 You need to install the package
3097 to see the content of this section in the output.
3100 \begin_layout Standard
3104 \begin_layout Plain Layout
3116 \begin_layout End PDF Form
3118 \begin_inset Note Note
3121 \begin_layout Plain Layout
3130 \begin_layout Section
3131 General notes and hints
3134 \begin_layout Itemize
3135 Submitting and applying data requires that all form fields have a name.
3138 \begin_layout Itemize
3139 All braces and brackets in form parameters must be inserted as TeX code!
3142 \begin_layout Itemize
3143 It is not possible to create a PDF form using XeTeX.
3144 Use either the LyX export formats
3155 \begin_layout Itemize
3156 To be able to use all kinds of colors and color definitions you must load
3161 in the document preamble this way:
3162 \begin_inset Newline newline
3169 usepackage[svgnames,rgb]{xcolor}
3172 \begin_layout Itemize
3181 custom background colors you must disable in these programs to highlight
3182 the available form fields in the PDF.
3185 \begin_layout Bibliography
3186 \begin_inset CommandInset bibitem
3187 LatexCommand bibitem
3193 \begin_inset CommandInset href
3195 name "JavaScript reference"
3196 target "https://developer.mozilla.org/en/docs/Web/JavaScript/Reference"
3203 \begin_layout Bibliography
3204 \begin_inset CommandInset bibitem
3205 LatexCommand bibitem
3211 \begin_inset CommandInset href
3213 name "Documentation"
3214 target "http://mirrors.ctan.org/macros/latex/contrib/hyperref/doc/manual.pdf"
3218 of the LaTeX package
3223 \begin_layout Bibliography
3224 \begin_inset CommandInset bibitem
3225 LatexCommand bibitem
3231 \begin_inset CommandInset href
3233 name "Documentation"
3234 target "http://mirrors.ctan.org/macros/latex/required/psnfss/psnfss2e.pdf"
3238 of the LaTeX package