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}
24 \ifinsdljs % only execute if package insdljs is installed
26 \begin{insDLJS}[exaaae]{exaaae}{JavaScript}
28 function validateTime(){
30 if((event.value == "u") || (event.value == "unlimited")) {
31 this.getField("from").display = display.hidden;
32 this.getField("to").display = display.hidden;
34 this.getField("from").display = display.visible;
35 this.getField("to").display = display.visible;
36 this.getField("from").setFocus();
41 function checkNumber() {
43 if (!Number(event.value))
45 app.alert("Value must be a number!");
48 event.target.textColor = color.green;
61 % set fonts for nicer pdf view
62 \IfFileExists{lmodern.sty}
63 {\usepackage{lmodern}}{}
65 \fi % end if pdflatex is used
67 \options BCOR8mm,pagesize
68 \use_default_options false
72 \maintain_unincluded_children false
74 \language_package default
79 \font_typewriter default
81 \font_default_family default
82 \use_non_tex_fonts false
88 \default_output_format default
90 \bibtex_command bibtex
91 \index_command default
95 \pdf_title "Description of the module pdfcomment"
96 \pdf_author "Uwe Stöhr"
97 \pdf_subject "PDF form"
98 \pdf_keywords "LyX, PDF forms, hyperref"
100 \pdf_bookmarksnumbered true
101 \pdf_bookmarksopen true
102 \pdf_bookmarksopenlevel 2
103 \pdf_breaklinks false
105 \pdf_colorlinks false
107 \pdf_pdfusetitle false
108 \pdf_quoted_options "linkcolor=black, citecolor=black, urlcolor=blue, filecolor=blue, pdfpagelayout=OneColumn, pdfnewwindow=true, pdfstartview=XYZ, plainpages=false, urlbordercolor={1 0 0}"
111 \use_package amsmath 1
112 \use_package amssymb 1
113 \use_package cancel 0
115 \use_package mathdots 1
116 \use_package mathtools 1
117 \use_package mhchem 1
118 \use_package stackrel 0
119 \use_package stmaryrd 0
120 \use_package undertilde 0
122 \cite_engine_type default
126 \paperorientation portrait
130 \notefontcolor #0000ff
137 \paragraph_separation skip
139 \quotes_language english
142 \paperpagestyle default
143 \tracking_changes false
144 \output_changes false
147 \html_be_strict false
152 \begin_layout Begin PDF Form
153 \begin_inset Argument 1
156 \begin_layout Plain Layout
157 action=mailto:forms@lyx.test?subject=The submitted PDF form, method=post
166 Description of the module PDF Form
173 \begin_layout Standard
174 \begin_inset Note Note
177 \begin_layout Plain Layout
178 To export all parts of this document to PDF the LaTeX-package
183 If it is not installed you can export the document anyway but the example
184 in the section about dynamic form fields won't appear in the output.
192 \begin_layout Standard
193 By loading the module PDF
197 Form the whole document or a part of it can be made a PDF form.
198 You can add all possible form elements like text fields buttons etc.
199 This document describes how this is done.
202 \begin_layout Section
204 \begin_inset CommandInset label
206 name "sec:Preparation"
213 \begin_layout Standard
214 At first load the module PDF
218 Form in the document settings of your file.
219 To make the whole document a form, insert the environment
231 from LyX's dropdown menu at the beginning of the document.
232 If only a part of the document should be a form, add
244 at the position where the form should start.
247 \begin_layout Standard
248 \begin_inset Note Greyedout
251 \begin_layout Plain Layout
256 It is only possible to have one form in a PDF file!
264 \begin_layout Standard
265 If the form data should be submitted to a server or the like, then you must
266 specify the URL as parameter of the
279 This is done by using the menu
281 Insert\SpecialChar \menuseparator
293 For example in this document the following was inserted to the parameter
297 \begin_layout Standard
300 action=mailto:forms@lyx.test?subject=The submitted PDF form,
301 \begin_inset Newline newline
307 \begin_layout Standard
308 This sends the form data as email to
312 when the user presses the submit button.
313 The email subject will be
314 \begin_inset Quotes eld
317 The submitted PDF form
318 \begin_inset Quotes erd
321 and the HTML method is
326 (The other possible method would be
330 .) For more about submitting see sec.
331 \begin_inset space \thinspace{}
335 \begin_inset CommandInset ref
337 reference "sub:Submit-button"
344 \begin_layout Standard
345 \begin_inset Newpage newpage
351 \begin_layout Section
355 \begin_layout Standard
360 possible types of fields in a PDF form:
363 \begin_layout Subsection
367 \begin_layout Standard
368 A text field is added by inserting the custom inset
374 Insert\SpecialChar \menuseparator
382 Write inside the inset the label for the text field that will be printed
383 in the PDF output before the field.
385 \begin_inset Newline newline
389 \begin_inset Flex TextField
392 \begin_layout Plain Layout
394 \begin_inset Argument 1
397 \begin_layout Plain Layout
403 Enter your name here:
411 \begin_layout Standard
412 You must also specify a field name for text fields: Set the cursor into
418 There insert for example the parameter
429 \begin_layout Standard
430 \begin_inset Note Greyedout
433 \begin_layout Plain Layout
438 All braces and brackets in form parameters must be inserted as TeX code!
446 \begin_layout Standard
447 Using the same name for several text fields results in an automatic duplication
448 of the inserted text.
449 This is for example useful if the user should input a date that should
450 appear at different places in the form.
451 \begin_inset Newline newline
458 fields as example: Fill one and see that the other one will also be filled
460 \begin_inset Newline newline
464 \begin_inset Flex TextField
467 \begin_layout Plain Layout
469 \begin_inset Argument 1
472 \begin_layout Plain Layout
484 \begin_inset Newline newline
488 \begin_inset Flex TextField
491 \begin_layout Plain Layout
493 \begin_inset Argument 1
496 \begin_layout Plain Layout
510 \begin_layout Standard
511 All form fields can be customized by adding parameters.
514 \begin_layout Standard
515 Here is a customized multiline text field with a width of 60
516 \begin_inset space \thinspace{}
519 % of the text width, 3
520 \begin_inset space \thinspace{}
523 cm height and a proposed content:
524 \begin_inset VSpace defskip
528 \begin_inset Newline newline
532 \begin_inset Flex TextField
535 \begin_layout Plain Layout
537 \begin_inset Argument 1
540 \begin_layout Plain Layout
541 name=customer2, multiline, width=0.6
543 textwidth, height=3cm, value={Testman}
548 Enter your name here:
556 \begin_layout Standard
557 \begin_inset Note Greyedout
560 \begin_layout Plain Layout
565 It is highly recommended to use a uniform layout of all fields in your
568 \begin_inset space \thinspace{}
572 \begin_inset CommandInset ref
574 reference "sec:Form-field-customization"
578 for how this is done.
586 \begin_layout Subsection
590 \begin_layout Standard
591 A check box is added by inserting the custom inset
596 Write inside the inset the label for the box.
598 \begin_inset Newline newline
602 \begin_inset Flex CheckBox
605 \begin_layout Plain Layout
607 \begin_inset Argument 1
610 \begin_layout Plain Layout
616 Are you older than 18 years?
624 \begin_layout Standard
625 You must also specify a field name for check boxes: Insert for example the
634 is the field name) into the
641 \begin_layout Subsection
645 \begin_layout Standard
646 A choice menu is added by inserting the custom inset
651 A label for the inset is added by using the menu
653 Insert\SpecialChar \menuseparator
657 Insert the label text into this inset.
658 \begin_inset Newline newline
661 The different choices are inserted to the inset as comma-separated list.
669 \begin_layout Description
670 Radio Only one choice can be selected
673 \begin_layout Description
674 Combo The choices are listed in a combo box (dropdown list) but the user
675 is allowed to choose something that is not in the predefined list.
678 \begin_layout Description
679 Popdown All choices are listed below each other.
680 It the filed is not high enough a scroll bar is automatically added to
684 \begin_layout Standard
685 To determine the choice menu type, add the parameter
700 \begin_layout Standard
701 Here is an example for the radio type:
702 \begin_inset VSpace defskip
706 \begin_inset Newline newline
710 \begin_inset Flex ChoiceMenu
713 \begin_layout Plain Layout
715 \begin_inset Argument 1
718 \begin_layout Plain Layout
725 \begin_inset Argument 2
728 \begin_layout Plain Layout
742 \begin_layout Standard
743 Here is an example for the combo type:
744 \begin_inset VSpace defskip
748 \begin_inset Newline newline
752 \begin_inset Flex ChoiceMenu
755 \begin_layout Plain Layout
757 \begin_inset Argument 1
760 \begin_layout Plain Layout
766 Albania=Al, Armenia=Ar, Azerbaidschan=Az
767 \begin_inset Argument 2
770 \begin_layout Plain Layout
784 \begin_layout Standard
785 Here is an example for the popdown type:
786 \begin_inset VSpace defskip
790 \begin_inset Newline newline
794 \begin_inset Flex ChoiceMenu
797 \begin_layout Plain Layout
799 \begin_inset Argument 1
802 \begin_layout Plain Layout
803 popdown, name=country
808 Albania=Al, Armenia=Ar, Azerbaidschan=Az
809 \begin_inset Argument 2
812 \begin_layout Plain Layout
826 \begin_layout Standard
827 You must also specify a field name for choice menus: Insert for example
836 is the field name) into the
843 \begin_layout Standard
844 It is recommended to add a short name for every choice to be able to access
845 them and to know which one was chosen by the user.
846 This is done by adding
850 behind each choice (where
855 For example the radio type example contains this choice list:
861 \begin_inset Quotes eld
865 \begin_inset Quotes erd
868 you know that he chose the choice
869 \begin_inset Quotes eld
873 \begin_inset Quotes erd
877 By specifying names you can also preset/propose e.g.
878 \begin_inset space \space{}
882 \begin_inset Quotes eld
886 \begin_inset Quotes erd
889 by adding the parameter
897 \begin_layout Standard
898 \begin_inset Flex ChoiceMenu
901 \begin_layout Plain Layout
903 \begin_inset Argument 1
906 \begin_layout Plain Layout
907 radio, name=sex, default=m
913 \begin_inset Argument 2
916 \begin_layout Plain Layout
930 \begin_layout Standard
931 \begin_inset Note Greyedout
934 \begin_layout Plain Layout
939 Due to a bug in the LaTeX package
943 it is currently only possible the set the first choice as default.
951 \begin_layout Standard
952 \begin_inset Newpage newpage
958 \begin_layout Subsection
962 \begin_layout Standard
963 A push button is added by inserting the custom inset
968 Write inside the inset the label for the button.
972 \begin_layout Standard
973 \begin_inset Flex PushButton
976 \begin_layout Plain Layout
978 \begin_inset Argument 1
981 \begin_layout Plain Layout
987 Don't click on this button or your fridge will be destroyed!!!
995 \begin_layout Standard
996 The action that is triggered by pressing the button is specified by JavaScript
998 To specify it, add the parameter
1002 and insert the JavaScript code between the braces.
1005 \begin_layout Standard
1006 \begin_inset Flex PushButton
1009 \begin_layout Plain Layout
1011 \begin_inset Argument 1
1014 \begin_layout Plain Layout
1015 onclick={app.alert("What the hell? Now you destroyed your fridge.
1021 Don't click on this button or your fridge will be destroyed!!!
1029 \begin_layout Standard
1030 For info about JavaScript, see its documentation,
1031 \begin_inset CommandInset citation
1040 \begin_layout Standard
1041 A common usage for pus buttons is to open a weblink.
1042 Such a button is created by inserting the command
1048 into the button inset.
1055 is used in the scheme
1056 \begin_inset Newline newline
1063 href{link target}{text}
1066 \begin_layout Standard
1067 In the following button this code was used:
1068 \begin_inset Newline newline
1075 href{http://wiki.lyx.org}{Information how to fill out this form}
1078 \begin_layout Standard
1079 \begin_inset Flex PushButton
1082 \begin_layout Plain Layout
1084 \begin_inset Argument 1
1087 \begin_layout Plain Layout
1095 href{http://wiki.lyx.org}{Information how to fill out this form}
1103 \begin_layout Standard
1104 To get rid of the frame for weblinks add this to the additional options
1105 in the document settings under
1108 \begin_inset space ~
1116 \begin_layout Standard
1119 urlbordercolor={1 0 0}
1122 \begin_layout Standard
1123 if your push button border color is red (the default), otherwise use the
1124 same color definition as for your push button border color.
1127 \begin_layout Subsection
1129 \begin_inset CommandInset label
1131 name "sub:Submit-button"
1138 \begin_layout Standard
1139 A submit button is used to submit the form data to a server.
1140 It is added by inserting the custom inset
1145 Write inside the inset the label for the button.
1149 \begin_layout Standard
1150 \begin_inset Flex SubmitButton
1153 \begin_layout Plain Layout
1155 \begin_inset Argument 1
1158 \begin_layout Plain Layout
1164 Send your data via email
1172 \begin_layout Standard
1173 The submit button creates a forms data format (FDF) file (file extension
1174 *.fdf) which is then submitted.
1175 The FDF file contains only the form data.
1176 They can only be applied to a PDF form if all fields in the form have a
1180 \begin_layout Standard
1181 \begin_inset Note Greyedout
1184 \begin_layout Plain Layout
1189 You can only use a submit button if you specified the submit method and
1190 target in the PDF form environment options! See sec.
1191 \begin_inset space \thinspace{}
1195 \begin_inset CommandInset ref
1197 reference "sec:Preparation"
1201 for the description.
1202 If there are no specifications you will get LaTeX errors!
1210 \begin_layout Standard
1211 \begin_inset Note Greyedout
1214 \begin_layout Plain Layout
1219 If you have more than one submit button in your document you must specify
1220 a name for each of them to avoid LaTeX errors! For example add
1228 is the button name).
1236 \begin_layout Subsection
1240 \begin_layout Standard
1241 A reset button is used to reset all form fields to the initial state.
1242 It is added by inserting the custom inset
1247 Write inside the inset the label for the button.
1251 \begin_layout Standard
1252 \begin_inset Flex ResetButton
1255 \begin_layout Plain Layout
1257 \begin_inset Argument 1
1260 \begin_layout Plain Layout
1274 \begin_layout Standard
1275 \begin_inset Note Greyedout
1278 \begin_layout Plain Layout
1283 If you have more than one reset button in your document you must specify
1284 a name for each of them to avoid LaTeX errors! For example add
1292 is the button name).
1300 \begin_layout Section
1301 Form field customization
1302 \begin_inset CommandInset label
1304 name "sec:Form-field-customization"
1311 \begin_layout Standard
1312 Since all form elements should look uniform, one can determine their layout
1313 using the following styles:
1316 \begin_layout Description
1318 \begin_inset space ~
1322 \begin_inset space ~
1328 \begin_layout Description
1330 \begin_inset space ~
1334 \begin_inset space ~
1340 \begin_layout Description
1342 \begin_inset space ~
1346 \begin_inset space ~
1349 Style affects all choice menu types
1352 \begin_layout Description
1354 \begin_inset space ~
1358 \begin_inset space ~
1361 Style affects only the combo box style
1364 \begin_layout Description
1366 \begin_inset space ~
1370 \begin_inset space ~
1373 Style affects only the popdown box style
1376 \begin_layout Description
1378 \begin_inset space ~
1382 \begin_inset space ~
1385 Style affects only the radio box style
1388 \begin_layout Description
1390 \begin_inset space ~
1394 \begin_inset space ~
1400 \begin_layout Description
1402 \begin_inset space ~
1406 \begin_inset space ~
1412 \begin_layout Description
1414 \begin_inset space ~
1418 \begin_inset space ~
1424 \begin_layout Text Field Style
1428 \begin_layout Standard
1429 The content of the styles is a comma-separated list of parameters.
1430 The possible parameters are listed in sec.
1431 \begin_inset space \thinspace{}
1435 \begin_inset Quotes eld
1438 Forms optional parameters
1439 \begin_inset Quotes erd
1442 of the documentation of the LaTeX package
1447 \begin_inset CommandInset citation
1454 It is important that the parameter print is always part of the definition,
1455 otherwise the fields won't appear in the PDF output.
1456 The defined style is applied to all fields following the definition.
1459 \begin_layout Subsubsection*
1460 Here are some examples:
1463 \begin_layout Text Field Style
1464 print, bordercolor=red, borderstyle=U, backgroundcolor=lightgray, color=lime,
1465 maxlen=10, align=2, charsize=16pt
1468 \begin_layout Check Box Style
1469 print, borderstyle=S, checkboxsymbol=
1474 \begin_layout Combo Box Style
1475 print, bordercolor={0.33 0.66 0.33}, borderstyle=D
1478 \begin_layout Popdown Box Style
1482 \begin_layout Radio Box Style
1483 print, borderstyle=I, radiosymbol=6
1486 \begin_layout Push Button Style
1487 print, borderstyle=B, bordercolor=lime
1490 \begin_layout Submit Button Style
1491 print, borderwidth=0, bordercolor=white
1494 \begin_layout Reset Button Style
1495 print, bordercolor=lime
1498 \begin_layout Itemize
1499 Text field with gray background, lime text color, a red border only below
1500 the field, right alignment, 16
1501 \begin_inset space \thinspace{}
1504 pt font size and a limitation for maximal 10
1505 \begin_inset space ~
1508 characters to insert:
1509 \begin_inset VSpace defskip
1513 \begin_inset Newline newline
1517 \begin_inset Flex TextField
1520 \begin_layout Plain Layout
1522 \begin_inset Argument 1
1525 \begin_layout Plain Layout
1531 Enter your name here:
1539 \begin_layout Standard
1567 \begin_layout Standard
1568 \begin_inset Note Greyedout
1571 \begin_layout Plain Layout
1580 has only an effect for text fields if a
1592 \begin_layout Itemize
1593 Check box with normal border and symbol
1596 \begin_inset VSpace defskip
1600 \begin_inset Newline newline
1604 \begin_inset Flex CheckBox
1607 \begin_layout Plain Layout
1609 \begin_inset Argument 1
1612 \begin_layout Plain Layout
1618 Are you older than 18 years?
1626 \begin_layout Standard
1627 The symbol is either specified as number or with the command
1628 \begin_inset Newline newline
1638 \begin_inset Newline newline
1645 is one of the possible numbers listed in Table
1646 \begin_inset space ~
1650 \begin_inset CommandInset citation
1659 \begin_layout Itemize
1660 Combo box with dashed, colored border:
1661 \begin_inset VSpace defskip
1665 \begin_inset Newline newline
1669 \begin_inset Flex ChoiceMenu
1672 \begin_layout Plain Layout
1674 \begin_inset Argument 1
1677 \begin_layout Plain Layout
1678 combo, name=combo2, default=Az
1683 Albania=Al, Armenia=Ar, Azerbaidschan=Az
1684 \begin_inset Argument 2
1687 \begin_layout Plain Layout
1701 \begin_layout Itemize
1702 Popdown box where only 2
1703 \begin_inset space ~
1706 entries are shown and where the last entry is preselected:
1707 \begin_inset VSpace defskip
1711 \begin_inset Newline newline
1715 \begin_inset Flex ChoiceMenu
1718 \begin_layout Plain Layout
1720 \begin_inset Argument 1
1723 \begin_layout Plain Layout
1724 popdown, name=country2, value=Az
1729 Albania=Al, Armenia=Ar, Azerbaidschan=Az
1730 \begin_inset Argument 2
1733 \begin_layout Plain Layout
1747 \begin_layout Standard
1748 \begin_inset VSpace defskip
1752 \begin_inset Note Greyedout
1755 \begin_layout Plain Layout
1772 has no effect for popdown boxes.
1780 \begin_layout Itemize
1781 Radio box with inverted bevel border and symbol number
1782 \begin_inset space ~
1786 \begin_inset VSpace defskip
1790 \begin_inset Newline newline
1794 \begin_inset Flex ChoiceMenu
1797 \begin_layout Plain Layout
1799 \begin_inset Argument 1
1802 \begin_layout Plain Layout
1809 \begin_inset Argument 2
1812 \begin_layout Plain Layout
1826 \begin_layout Itemize
1827 Push button with a bevel border and colored text:
1828 \begin_inset VSpace defskip
1832 \begin_inset Newline newline
1836 \begin_inset Flex PushButton
1839 \begin_layout Plain Layout
1841 \begin_inset Argument 1
1844 \begin_layout Plain Layout
1845 onclick={app.alert("Why do you click this?")}
1854 textcolor{red}{Don't click on this button!!!}}
1862 \begin_layout Standard
1863 \begin_inset VSpace defskip
1867 \begin_inset Note Greyedout
1870 \begin_layout Plain Layout
1883 has no effect for push, submit and reset buttons.
1891 \begin_layout Standard
1892 As workaround use the command
1898 as described in sec.
1899 \begin_inset space \thinspace{}
1903 \begin_inset Quotes eld
1907 \begin_inset Quotes erd
1920 that is used is used in the scheme
1921 \begin_inset Newline newline
1928 textcolor{color}{characters to color}
1931 \begin_inset Newline newline
1934 In the button above this code was used:
1935 \begin_inset Newline newline
1944 textcolor{red}{Don't click on this button!!!}}
1947 \begin_layout Standard
1948 \begin_inset Note Greyedout
1951 \begin_layout Plain Layout
1964 has no effect for push, submit and reset buttons.
1972 \begin_layout Standard
1973 As workaround use the box method described in sec.
1974 \begin_inset space \thinspace{}
1978 \begin_inset CommandInset ref
1980 reference "sub:Action-button-customization"
1987 \begin_layout Itemize
1988 Submit button without border, with cyan background color and increased height:
1989 \begin_inset VSpace defskip
1993 \begin_inset Newline newline
1997 \begin_inset Flex SubmitButton
2000 \begin_layout Plain Layout
2002 \begin_inset Argument 1
2005 \begin_layout Plain Layout
2019 centering Send your data via mail}}
2025 \begin_inset VSpace bigskip
2031 \begin_layout Itemize
2032 Reset button with a width of 7
2033 \begin_inset space \thinspace{}
2037 \begin_inset VSpace defskip
2041 \begin_inset Newline newline
2045 \begin_inset Flex ResetButton
2048 \begin_layout Plain Layout
2050 \begin_inset Argument 1
2053 \begin_layout Plain Layout
2061 makebox[7cm]{Reset the form}
2069 \begin_layout Section
2070 PDF viewer action buttons
2073 \begin_layout Standard
2074 One often needs basic actions to be done by the PDF viewer program.
2075 For example to print the form.
2076 Such PDF program-specific actions can be triggered by adding inserting
2082 The PDF viewer programs
2090 can handle all possible actions while other PDF viewers might only support
2092 However, all PDF viewer programs support the basic things like printing,
2094 \begin_inset space ~
2097 as, view in fullscreen etc..
2100 \begin_layout Standard
2101 To specify the action insert its name to the
2106 A list with possible actions can be found in sec.
2107 \begin_inset space \thinspace{}
2111 \begin_inset Quotes eld
2114 Acrobat-specific behavior
2115 \begin_inset Quotes erd
2118 of the documentation of the LaTeX package
2123 \begin_inset CommandInset citation
2132 \begin_layout Standard
2133 Here are some examples:
2136 \begin_layout Description
2138 \begin_inset Flex PDFAction
2141 \begin_layout Plain Layout
2143 \begin_inset Argument 1
2146 \begin_layout Plain Layout
2160 \begin_layout Description
2162 \begin_inset space ~
2166 \begin_inset Flex PDFAction
2169 \begin_layout Plain Layout
2171 \begin_inset Argument 1
2174 \begin_layout Plain Layout
2188 \begin_layout Description
2190 \begin_inset space ~
2194 \begin_inset space ~
2198 \begin_inset Flex PDFAction
2201 \begin_layout Plain Layout
2203 \begin_inset Argument 1
2206 \begin_layout Plain Layout
2212 View the form in fullscreen
2220 \begin_layout Subsection
2221 Action button customization
2222 \begin_inset CommandInset label
2224 name "sub:Action-button-customization"
2231 \begin_layout Standard
2232 Customizing the action buttons requires some complicated LaTeX code because
2233 things like the width, height and border separation cannot be specified
2234 as button parameters.
2237 \begin_layout Standard
2238 The easiest way to customize the buttons is to fill it with a custom box:
2241 \begin_layout Enumerate
2242 Create a normal LyX box of your choice
2245 \begin_layout Enumerate
2248 View\SpecialChar \menuseparator
2250 \begin_inset space ~
2255 to show the source code window (if not already shown)
2258 \begin_layout Enumerate
2259 set the cursor into the box and copy the corresponding LaTeX code from the
2263 \begin_layout Enumerate
2264 paste it t the content of the
2271 \begin_layout Standard
2272 For example the button should be 4
2273 \begin_inset space \thinspace{}
2276 cm wide and have the height of 2 lines.
2277 Then create this parbox:
2278 \begin_inset Newline newline
2282 \begin_inset Box Frameless
2292 height_special "totalheight"
2295 \begin_layout Plain Layout
2303 \begin_inset Newline newline
2306 and copy its LaTeX code to the button
2311 To center the text in the button add
2313 centering right before the button text.
2317 \begin_layout Standard
2318 \begin_inset Flex PDFAction
2321 \begin_layout Plain Layout
2323 \begin_inset Argument 1
2326 \begin_layout Plain Layout
2338 centering Save form as}
2346 \begin_layout Standard
2347 To customize the border color, add the command
2349 menubordercolor={r g b}
2351 to the additional options in the document settings under
2354 \begin_inset space ~
2371 with a number between 0 and 1 for the colors red, green and blue.
2372 If you want to change the border color only for certain buttons, use the
2376 \begin_inset space ~
2380 \begin_inset space ~
2385 before the button and insert there the command
2390 The default value of
2401 \begin_layout PDF Link Setup
2402 menubordercolor={0.1 0.9 0.5}
2405 \begin_layout Standard
2408 menubordercolor={0.1 0.9 0.5}
2411 \begin_inset Newline newline
2415 \begin_inset Flex PDFAction
2418 \begin_layout Plain Layout
2420 \begin_inset Argument 1
2423 \begin_layout Plain Layout
2435 centering Save form as}
2443 \begin_layout Standard
2444 To change the border width use the command
2452 is the width in pixels.
2453 The default value of
2464 \begin_layout Standard
2465 \begin_inset Note Greyedout
2468 \begin_layout Plain Layout
2477 affects all link types, not only the menu links.
2485 \begin_layout PDF Link Setup
2486 pdfborder={0 0 4}, menubordercolor={1 1 0}
2489 \begin_layout Standard
2491 \begin_inset space ~
2494 pixel thick yellow border:
2495 \begin_inset Newline newline
2499 \begin_inset Flex PDFAction
2502 \begin_layout Plain Layout
2504 \begin_inset Argument 1
2507 \begin_layout Plain Layout
2519 centering Save form as}
2527 \begin_layout Standard
2528 To change the background color insert the command
2534 at the beginning of the button inset and a
2543 is hereby the name of the color as described in sec.
2544 \begin_inset space \thinspace{}
2548 \begin_inset Quotes eld
2552 \begin_inset Quotes erd
2562 \begin_layout PDF Link Setup
2566 \begin_layout Standard
2567 An example without a border and with a background color:
2568 \begin_inset Newline newline
2572 \begin_inset Flex PDFAction
2575 \begin_layout Plain Layout
2577 \begin_inset Argument 1
2580 \begin_layout Plain Layout
2594 centering Save form as}}
2602 \begin_layout PDF Link Setup
2603 pdfborder={0 0 1}, menubordercolor={1 0 0}
2606 \begin_layout Section
2610 \begin_layout Standard
2611 It is also possible to have dynamic form fields.
2612 This means that depending on the actions of the user fields can (dis)appear
2613 or change their appearance.
2614 To use this feature, add these lines to your document preamble:
2617 \begin_layout Standard
2622 usepackage[pdftex]{insdljs}
2623 \begin_inset Newline newline
2637 \begin_layout Standard
2638 Then add the necessary JavaScript code to your document LaTeX preamble or
2639 as TeX code to your document.
2640 For info about JavaScript, see its documentation,
2641 \begin_inset CommandInset citation
2650 \begin_layout Standard
2654 \begin_layout Plain Layout
2664 \begin_inset Note Note
2667 \begin_layout Plain Layout
2668 The following section will only be displayed when the LaTeX package
2680 \begin_layout Standard
2681 For the following choice menu this JavaScript code was used:
2684 \begin_layout Standard
2685 \begin_inset listings
2686 lstparams "language=TeX"
2690 \begin_layout Plain Layout
2694 begin{insDLJS}[exaaae]{exaaae}{JavaScript}
2697 \begin_layout Plain Layout
2699 function validateTime(){
2702 \begin_layout Plain Layout
2707 \begin_layout Plain Layout
2709 if((event.value == "u") || (event.value == "unlimited")) {
2712 \begin_layout Plain Layout
2714 this.getField("from").display = display.hidden;
2717 \begin_layout Plain Layout
2719 this.getField("to").display = display.hidden;
2722 \begin_layout Plain Layout
2727 \begin_layout Plain Layout
2729 this.getField("from").display = display.visible;
2732 \begin_layout Plain Layout
2734 this.getField("to").display = display.visible;
2737 \begin_layout Plain Layout
2739 this.getField("from").setFocus();
2742 \begin_layout Plain Layout
2747 \begin_layout Plain Layout
2752 \begin_layout Plain Layout
2757 \begin_layout Plain Layout
2769 \begin_layout Standard
2770 \begin_inset Note Greyedout
2773 \begin_layout Plain Layout
2782 JavaScript funtions must be inserted into the same
2794 \begin_layout Standard
2798 \begin_inset space ~
2802 \begin_inset space ~
2807 of the following choice menu are
2808 \begin_inset Newline newline
2813 name=contract,radio,default=tl,validate={validateTime();}
2816 \begin_layout Standard
2817 \begin_inset Flex ChoiceMenu
2820 \begin_layout Plain Layout
2822 \begin_inset Argument 1
2825 \begin_layout Plain Layout
2826 name=contract,radio,default=tl,validate={validateTime();}
2831 term-limited=tl, unlimited=u
2832 \begin_inset Argument 2
2835 \begin_layout Plain Layout
2847 \begin_inset VSpace defskip
2853 \begin_layout Standard
2854 \begin_inset Tabular
2855 <lyxtabular version="3" rows="3" columns="2">
2856 <features rotate="0" tabularvalignment="middle">
2857 <column alignment="left" valignment="top">
2858 <column alignment="center" valignment="top">
2860 <cell alignment="left" valignment="top" usebox="none">
2863 \begin_layout Plain Layout
2869 <cell alignment="center" valignment="top" usebox="none">
2872 \begin_layout Plain Layout
2873 \begin_inset Flex TextField
2876 \begin_layout Plain Layout
2878 \begin_inset Argument 1
2881 \begin_layout Plain Layout
2882 name=from,width=10em
2899 <cell alignment="center" valignment="top" usebox="none">
2902 \begin_layout Plain Layout
2908 <cell alignment="center" valignment="top" usebox="none">
2911 \begin_layout Plain Layout
2912 \begin_inset VSpace -1.5mm
2922 <cell alignment="left" valignment="top" usebox="none">
2925 \begin_layout Plain Layout
2931 <cell alignment="center" valignment="top" usebox="none">
2934 \begin_layout Plain Layout
2935 \begin_inset Flex TextField
2938 \begin_layout Plain Layout
2940 \begin_inset Argument 1
2943 \begin_layout Plain Layout
2967 \begin_layout Standard
2968 \begin_inset VSpace bigskip
2974 \begin_layout Standard
2975 To check and assure that the user only enters a number to a text field you
2976 can for example use this JavaScript code:
2979 \begin_layout Standard
2980 \begin_inset listings
2981 lstparams "language=TeX"
2985 \begin_layout Plain Layout
2987 function checkNumber() {
2990 \begin_layout Plain Layout
2995 \begin_layout Plain Layout
2997 if (!Number(event.value)) {
3000 \begin_layout Plain Layout
3002 app.alert("Value must be a number!");
3005 \begin_layout Plain Layout
3010 \begin_layout Plain Layout
3015 \begin_layout Plain Layout
3017 event.target.textColor = color.green;
3020 \begin_layout Plain Layout
3030 \begin_layout Standard
3031 An example text field:
3032 \begin_inset Flex TextField
3035 \begin_layout Plain Layout
3037 \begin_inset Argument 1
3040 \begin_layout Plain Layout
3041 name=onlyNumbers, align=1, validate={checkNumber();}
3054 \begin_layout Standard
3058 \begin_layout Plain Layout
3068 \begin_inset Note Note
3071 \begin_layout Plain Layout
3072 The following will be displayed when the LaTeX package
3084 \begin_layout Standard
3085 You need to install the package
3089 to see the content of this section in the output.
3092 \begin_layout Standard
3096 \begin_layout Plain Layout
3108 \begin_layout End PDF Form
3109 \begin_inset Note Note
3112 \begin_layout Plain Layout
3121 \begin_layout Section
3122 General notes and hints
3125 \begin_layout Itemize
3126 Submitting and applying data requires that all form fields have a name.
3129 \begin_layout Itemize
3130 All braces and brackets in form parameters must be inserted as TeX code!
3133 \begin_layout Itemize
3134 It is not possible to create a PDF form using XeTeX.
3135 Use either the LyX export formats
3146 \begin_layout Itemize
3147 To be able to use all kinds of colors and color definitions you must load
3152 in the document preamble this way:
3153 \begin_inset Newline newline
3160 usepackage[svgnames,rgb]{xcolor}
3163 \begin_layout Itemize
3172 custom background colors you must disable in these programs to highlight
3173 the available form fields in the PDF.
3176 \begin_layout Bibliography
3177 \begin_inset CommandInset bibitem
3178 LatexCommand bibitem
3184 \begin_inset CommandInset href
3186 name "JavaScript reference"
3187 target "https://developer.mozilla.org/en/docs/Web/JavaScript/Reference"
3194 \begin_layout Bibliography
3195 \begin_inset CommandInset bibitem
3196 LatexCommand bibitem
3202 \begin_inset CommandInset href
3204 name "Documentation"
3205 target "http://mirrors.ctan.org/macros/latex/contrib/hyperref/doc/manual.pdf"
3209 of the LaTeX package
3214 \begin_layout Bibliography
3215 \begin_inset CommandInset bibitem
3216 LatexCommand bibitem
3222 \begin_inset CommandInset href
3224 name "Documentation"
3225 target "http://mirrors.ctan.org/macros/latex/required/psnfss/psnfss2e.pdf"
3229 of the LaTeX package