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}
25 \begin{insDLJS}[exaaae]{exaaae}{JavaScript}
27 function validateTime(){
29 if((event.value == "u") || (event.value == "unlimited")) {
30 this.getField("from").display = display.hidden;
31 this.getField("to").display = display.hidden;
33 this.getField("from").display = display.visible;
34 this.getField("to").display = display.visible;
35 this.getField("from").setFocus();
40 function checkNumber() {
42 if (!Number(event.value))
44 app.alert("Value must be a number!");
47 event.target.textColor = color.green;
59 % set fonts for nicer pdf view
60 \IfFileExists{lmodern.sty}
61 {\usepackage{lmodern}}{}
63 \fi % end if pdflatex is used
65 \options BCOR8mm,pagesize
66 \use_default_options false
70 \maintain_unincluded_children false
72 \language_package default
77 \font_typewriter default
79 \font_default_family default
80 \use_non_tex_fonts false
86 \default_output_format default
88 \bibtex_command bibtex
89 \index_command default
93 \pdf_title "Description of the module pdfcomment"
94 \pdf_author "Uwe Stöhr"
95 \pdf_subject "PDF form"
96 \pdf_keywords "LyX, PDF forms, hyperref"
98 \pdf_bookmarksnumbered true
99 \pdf_bookmarksopen true
100 \pdf_bookmarksopenlevel 2
101 \pdf_breaklinks false
103 \pdf_colorlinks false
105 \pdf_pdfusetitle false
106 \pdf_quoted_options "linkcolor=black, citecolor=black, urlcolor=blue, filecolor=blue, pdfpagelayout=OneColumn, pdfnewwindow=true, pdfstartview=XYZ, plainpages=false, urlbordercolor={1 0 0}"
109 \use_package amsmath 1
110 \use_package amssymb 1
111 \use_package cancel 0
113 \use_package mathdots 1
114 \use_package mathtools 1
115 \use_package mhchem 1
116 \use_package stackrel 0
117 \use_package stmaryrd 0
118 \use_package undertilde 0
120 \cite_engine_type default
124 \paperorientation portrait
128 \notefontcolor #0000ff
135 \paragraph_separation skip
137 \quotes_language english
140 \paperpagestyle default
141 \tracking_changes false
142 \output_changes false
145 \html_be_strict false
150 \begin_layout Begin PDF Form
151 \begin_inset Argument 1
154 \begin_layout Plain Layout
155 action=mailto:forms@lyx.test?subject=The submitted PDF form, method=post
164 Description of the module PDF Form
171 \begin_layout Standard
172 \begin_inset Note Note
175 \begin_layout Plain Layout
176 To export all parts of this document to PDF the LaTeX-package
181 If it is not installed you can export the document anyway but the example
182 in the section about dynamic form fields won't appear in the output.
190 \begin_layout Standard
191 By loading the module PDF
195 Form the whole document or a part of it can be made a PDF form.
196 You can add all possible form elements like text fields buttons etc.
197 This document describes how this is done.
200 \begin_layout Section
202 \begin_inset CommandInset label
204 name "sec:Preparation"
211 \begin_layout Standard
212 At first load the module PDF
216 Form in the document settings of your file.
217 To make the whole document a form, insert the environment
229 from LyX's dropdown menu at the beginning of the document.
230 If only a part of the document should be a form, add
242 at the position where the form should start.
245 \begin_layout Standard
246 \begin_inset Note Greyedout
249 \begin_layout Plain Layout
254 It is only possible to have one form in a PDF file!
262 \begin_layout Standard
263 If the form data should be submitted to a server or the like, then you must
264 specify the URL as parameter of the
277 This is done by using the menu
279 Insert\SpecialChar \menuseparator
291 For example in this document the following was inserted to the parameter
295 \begin_layout Standard
298 action=mailto:forms@lyx.test?subject=The submitted PDF form,
299 \begin_inset Newline newline
305 \begin_layout Standard
306 This sends the form data as email to
310 when the user presses the submit button.
311 The email subject will be
312 \begin_inset Quotes eld
315 The submitted PDF form
316 \begin_inset Quotes erd
319 and the HTML method is
324 (The other possible method would be
328 .) For more about submitting see sec.
329 \begin_inset space \thinspace{}
333 \begin_inset CommandInset ref
335 reference "sub:Submit-button"
342 \begin_layout Standard
343 \begin_inset Newpage newpage
349 \begin_layout Section
353 \begin_layout Standard
358 possible types of fields in a PDF form:
361 \begin_layout Subsection
365 \begin_layout Standard
366 A text field is added by inserting the custom inset
372 Insert\SpecialChar \menuseparator
380 Write inside the inset the label for the text field that will be printed
381 in the PDF output before the field.
383 \begin_inset Newline newline
387 \begin_inset Flex TextField
390 \begin_layout Plain Layout
391 \begin_inset Argument 1
394 \begin_layout Plain Layout
400 Enter your name here:
408 \begin_layout Standard
409 You must also specify a field name for text fields: Set the cursor into
415 There insert for example the parameter
426 \begin_layout Standard
427 \begin_inset Note Greyedout
430 \begin_layout Plain Layout
435 All braces and brackets in form parameters must be inserted as TeX code!
443 \begin_layout Standard
444 Using the same name for several text fields results in an automatic duplication
445 of the inserted text.
446 This is for example useful if the user should input a date that should
447 appear at different places in the form.
448 \begin_inset Newline newline
455 fields as example: Fill one and see that the other one will also be filled
457 \begin_inset Newline newline
461 \begin_inset Flex TextField
464 \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
488 \begin_inset Argument 1
491 \begin_layout Plain Layout
505 \begin_layout Standard
506 All form fields can be customized by adding parameters.
509 \begin_layout Standard
510 Here is a customized multiline text field with a width of 60
511 \begin_inset space \thinspace{}
514 % of the text width, 3
515 \begin_inset space \thinspace{}
518 cm height and a proposed content:
519 \begin_inset VSpace defskip
523 \begin_inset Newline newline
527 \begin_inset Flex TextField
530 \begin_layout Plain Layout
531 \begin_inset Argument 1
534 \begin_layout Plain Layout
535 name=customer2, multiline, width=0.6
537 textwidth, height=3cm, value={Testman}
542 Enter your name here:
550 \begin_layout Standard
551 \begin_inset Note Greyedout
554 \begin_layout Plain Layout
559 It is highly recommended to use a uniform layout of all fields in your
562 \begin_inset space \thinspace{}
566 \begin_inset CommandInset ref
568 reference "sec:Form-field-customization"
572 for how this is done.
580 \begin_layout Subsection
584 \begin_layout Standard
585 A check box is added by inserting the custom inset
590 Write inside the inset the label for the box.
592 \begin_inset Newline newline
596 \begin_inset Flex CheckBox
599 \begin_layout Plain Layout
600 \begin_inset Argument 1
603 \begin_layout Plain Layout
609 Are you older than 18 years?
617 \begin_layout Standard
618 You must also specify a field name for check boxes: Insert for example the
627 is the field name) into the
634 \begin_layout Subsection
638 \begin_layout Standard
639 A choice menu is added by inserting the custom inset
644 A label for the inset is added by using the menu
646 Insert\SpecialChar \menuseparator
650 Insert the label text into this inset.
651 \begin_inset Newline newline
654 The different choices are inserted to the inset as comma-separated list.
662 \begin_layout Description
663 Radio Only one choice can be selected
666 \begin_layout Description
667 Combo The choices are listed in a combo box (dropdown list) but the user
668 is allowed to choose something that is not in the predefined list.
671 \begin_layout Description
672 Popdown All choices are listed below each other.
673 It the filed is not high enough a scroll bar is automatically added to
677 \begin_layout Standard
678 To determine the choice menu type, add the parameter
693 \begin_layout Standard
694 Here is an example for the radio type:
695 \begin_inset VSpace defskip
699 \begin_inset Newline newline
703 \begin_inset Flex ChoiceMenu
706 \begin_layout Plain Layout
707 \begin_inset Argument 1
710 \begin_layout Plain Layout
717 \begin_inset Argument 2
720 \begin_layout Plain Layout
734 \begin_layout Standard
735 Here is an example for the combo type:
736 \begin_inset VSpace defskip
740 \begin_inset Newline newline
744 \begin_inset Flex ChoiceMenu
747 \begin_layout Plain Layout
748 \begin_inset Argument 1
751 \begin_layout Plain Layout
757 Albania=Al, Armenia=Ar, Azerbaidschan=Az
758 \begin_inset Argument 2
761 \begin_layout Plain Layout
775 \begin_layout Standard
776 Here is an example for the popdown type:
777 \begin_inset VSpace defskip
781 \begin_inset Newline newline
785 \begin_inset Flex ChoiceMenu
788 \begin_layout Plain Layout
789 \begin_inset Argument 1
792 \begin_layout Plain Layout
793 popdown, name=country
798 Albania=Al, Armenia=Ar, Azerbaidschan=Az
799 \begin_inset Argument 2
802 \begin_layout Plain Layout
816 \begin_layout Standard
817 You must also specify a field name for choice menus: Insert for example
826 is the field name) into the
833 \begin_layout Standard
834 It is recommended to add a short name for every choice to be able to access
835 them and to know which one was chosen by the user.
836 This is done by adding
840 behind each choice (where
845 For example the radio type example contains this choice list:
851 \begin_inset Quotes eld
855 \begin_inset Quotes erd
858 you know that he chose the choice
859 \begin_inset Quotes eld
863 \begin_inset Quotes erd
867 By specifying names you can also preset/propose e.g.
868 \begin_inset space \space{}
872 \begin_inset Quotes eld
876 \begin_inset Quotes erd
879 by adding the parameter
887 \begin_layout Standard
888 \begin_inset Flex ChoiceMenu
891 \begin_layout Plain Layout
892 \begin_inset Argument 1
895 \begin_layout Plain Layout
896 radio, name=sex, default=m
902 \begin_inset Argument 2
905 \begin_layout Plain Layout
919 \begin_layout Standard
920 \begin_inset Note Greyedout
923 \begin_layout Plain Layout
928 Due to a bug in the LaTeX package
932 it is currently only possible the set the first choice as default.
940 \begin_layout Standard
941 \begin_inset Newpage newpage
947 \begin_layout Subsection
951 \begin_layout Standard
952 A push button is added by inserting the custom inset
957 Write inside the inset the label for the button.
961 \begin_layout Standard
962 \begin_inset Flex PushButton
965 \begin_layout Plain Layout
966 \begin_inset Argument 1
969 \begin_layout Plain Layout
975 Don't click on this button or your fridge will be destroyed!!!
983 \begin_layout Standard
984 The action that is triggered by pressing the button is specified by JavaScript
986 To specify it, add the parameter
990 and insert the JavaScript code between the braces.
993 \begin_layout Standard
994 \begin_inset Flex PushButton
997 \begin_layout Plain Layout
998 \begin_inset Argument 1
1001 \begin_layout Plain Layout
1002 onclick={app.alert("What the hell? Now you destroyed your fridge.
1008 Don't click on this button or your fridge will be destroyed!!!
1016 \begin_layout Standard
1017 For info about JavaScript, see its documentation,
1018 \begin_inset CommandInset citation
1027 \begin_layout Standard
1028 A common usage for pus buttons is to open a weblink.
1029 Such a button is created by inserting the command
1035 into the button inset.
1042 is used in the scheme
1043 \begin_inset Newline newline
1050 href{link target}{text}
1053 \begin_layout Standard
1054 In the following button this code was used:
1055 \begin_inset Newline newline
1062 href{http://wiki.lyx.org}{Information how to fill out this form}
1065 \begin_layout Standard
1066 \begin_inset Flex PushButton
1069 \begin_layout Plain Layout
1070 \begin_inset Argument 1
1073 \begin_layout Plain Layout
1081 href{http://wiki.lyx.org}{Information how to fill out this form}
1089 \begin_layout Standard
1090 To get rid of the frame for weblinks add this to the additional options
1091 in the document settings under
1094 \begin_inset space ~
1102 \begin_layout Standard
1105 urlbordercolor={1 0 0}
1108 \begin_layout Standard
1109 if your push button border color is red (the default), otherwise use the
1110 same color definition as for your push button border color.
1113 \begin_layout Subsection
1115 \begin_inset CommandInset label
1117 name "sub:Submit-button"
1124 \begin_layout Standard
1125 A submit button is used to submit the form data to a server.
1126 It is added by inserting the custom inset
1131 Write inside the inset the label for the button.
1135 \begin_layout Standard
1136 \begin_inset Flex SubmitButton
1139 \begin_layout Plain Layout
1140 \begin_inset Argument 1
1143 \begin_layout Plain Layout
1149 Send your data via email
1157 \begin_layout Standard
1158 The submit button creates a forms data format (FDF) file (file extension
1159 *.fdf) which is then submitted.
1160 The FDF file contains only the form data.
1161 They can only be applied to a PDF form if all fields in the form have a
1165 \begin_layout Standard
1166 \begin_inset Note Greyedout
1169 \begin_layout Plain Layout
1174 You can only use a submit button if you specified the submit method and
1175 target in the PDF form environment options! See sec.
1176 \begin_inset space \thinspace{}
1180 \begin_inset CommandInset ref
1182 reference "sec:Preparation"
1186 for the description.
1187 If there are no specifications you will get LaTeX errors!
1195 \begin_layout Standard
1196 \begin_inset Note Greyedout
1199 \begin_layout Plain Layout
1204 If you have more than one submit button in your document you must specify
1205 a name for each of them to avoid LaTeX errors! For example add
1213 is the button name).
1221 \begin_layout Subsection
1225 \begin_layout Standard
1226 A reset button is used to reset all form fields to the initial state.
1227 It is added by inserting the custom inset
1232 Write inside the inset the label for the button.
1236 \begin_layout Standard
1237 \begin_inset Flex ResetButton
1240 \begin_layout Plain Layout
1241 \begin_inset Argument 1
1244 \begin_layout Plain Layout
1258 \begin_layout Standard
1259 \begin_inset Note Greyedout
1262 \begin_layout Plain Layout
1267 If you have more than one reset button in your document you must specify
1268 a name for each of them to avoid LaTeX errors! For example add
1276 is the button name).
1284 \begin_layout Section
1285 Form field customization
1286 \begin_inset CommandInset label
1288 name "sec:Form-field-customization"
1295 \begin_layout Standard
1296 Since all form elements should look uniform, one can determine their layout
1297 using the following styles:
1300 \begin_layout Description
1302 \begin_inset space ~
1306 \begin_inset space ~
1312 \begin_layout Description
1314 \begin_inset space ~
1318 \begin_inset space ~
1324 \begin_layout Description
1326 \begin_inset space ~
1330 \begin_inset space ~
1333 Style affects all choice menu types
1336 \begin_layout Description
1338 \begin_inset space ~
1342 \begin_inset space ~
1345 Style affects only the combo box style
1348 \begin_layout Description
1350 \begin_inset space ~
1354 \begin_inset space ~
1357 Style affects only the popdown box style
1360 \begin_layout Description
1362 \begin_inset space ~
1366 \begin_inset space ~
1369 Style affects only the radio box style
1372 \begin_layout Description
1374 \begin_inset space ~
1378 \begin_inset space ~
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 Text Field Style
1412 \begin_layout Standard
1413 The content of the styles is a comma-separated list of parameters.
1414 The possible parameters are listed in sec.
1415 \begin_inset space \thinspace{}
1419 \begin_inset Quotes eld
1422 Forms optional parameters
1423 \begin_inset Quotes erd
1426 of the documentation of the LaTeX package
1431 \begin_inset CommandInset citation
1438 It is important that the parameter print is always part of the definition,
1439 otherwise the fields won't appear in the PDF output.
1440 The defined style is applied to all fields following the definition.
1443 \begin_layout Subsubsection*
1444 Here are some examples:
1447 \begin_layout Text Field Style
1448 print, bordercolor=red, borderstyle=U, backgroundcolor=lightgray, color=lime,
1449 maxlen=10, align=2, charsize=16pt
1452 \begin_layout Check Box Style
1453 print, borderstyle=S, checkboxsymbol=
1458 \begin_layout Combo Box Style
1459 print, bordercolor={0.33 0.66 0.33}, borderstyle=D
1462 \begin_layout Popdown Box Style
1466 \begin_layout Radio Box Style
1467 print, borderstyle=I, radiosymbol=6
1470 \begin_layout Push Button Style
1471 print, borderstyle=B, bordercolor=lime
1474 \begin_layout Submit Button Style
1475 print, borderwidth=0, bordercolor=white
1478 \begin_layout Reset Button Style
1479 print, bordercolor=lime
1482 \begin_layout Itemize
1483 Text field with gray background, lime text color, a red border only below
1484 the field, right alignment, 16
1485 \begin_inset space \thinspace{}
1488 pt font size and a limitation for maximal 10
1489 \begin_inset space ~
1492 characters to insert:
1493 \begin_inset VSpace defskip
1497 \begin_inset Newline newline
1501 \begin_inset Flex TextField
1504 \begin_layout Plain Layout
1505 \begin_inset Argument 1
1508 \begin_layout Plain Layout
1514 Enter your name here:
1522 \begin_layout Standard
1550 \begin_layout Standard
1551 \begin_inset Note Greyedout
1554 \begin_layout Plain Layout
1563 has only an effect for text fields if a
1575 \begin_layout Itemize
1576 Check box with normal border and symbol
1579 \begin_inset VSpace defskip
1583 \begin_inset Newline newline
1587 \begin_inset Flex CheckBox
1590 \begin_layout Plain Layout
1591 \begin_inset Argument 1
1594 \begin_layout Plain Layout
1600 Are you older than 18 years?
1608 \begin_layout Standard
1609 The symbol is either specified as number or with the command
1610 \begin_inset Newline newline
1620 \begin_inset Newline newline
1627 is one of the possible numbers listed in Table
1628 \begin_inset space ~
1632 \begin_inset CommandInset citation
1641 \begin_layout Itemize
1642 Combo box with dashed, colored border:
1643 \begin_inset VSpace defskip
1647 \begin_inset Newline newline
1651 \begin_inset Flex ChoiceMenu
1654 \begin_layout Plain Layout
1655 \begin_inset Argument 1
1658 \begin_layout Plain Layout
1659 combo, name=combo2, default=Az
1664 Albania=Al, Armenia=Ar, Azerbaidschan=Az
1665 \begin_inset Argument 2
1668 \begin_layout Plain Layout
1682 \begin_layout Itemize
1683 Popdown box where only 2
1684 \begin_inset space ~
1687 entries are shown and where the last entry is preselected:
1688 \begin_inset VSpace defskip
1692 \begin_inset Newline newline
1696 \begin_inset Flex ChoiceMenu
1699 \begin_layout Plain Layout
1700 \begin_inset Argument 1
1703 \begin_layout Plain Layout
1704 popdown, name=country2, value=Az
1709 Albania=Al, Armenia=Ar, Azerbaidschan=Az
1710 \begin_inset Argument 2
1713 \begin_layout Plain Layout
1727 \begin_layout Standard
1728 \begin_inset VSpace defskip
1732 \begin_inset Note Greyedout
1735 \begin_layout Plain Layout
1752 has no effect for popdown boxes.
1760 \begin_layout Itemize
1761 Radio box with inverted bevel border and symbol number
1762 \begin_inset space ~
1766 \begin_inset VSpace defskip
1770 \begin_inset Newline newline
1774 \begin_inset Flex ChoiceMenu
1777 \begin_layout Plain Layout
1778 \begin_inset Argument 1
1781 \begin_layout Plain Layout
1788 \begin_inset Argument 2
1791 \begin_layout Plain Layout
1805 \begin_layout Itemize
1806 Push button with a bevel border and colored text:
1807 \begin_inset VSpace defskip
1811 \begin_inset Newline newline
1815 \begin_inset Flex PushButton
1818 \begin_layout Plain Layout
1819 \begin_inset Argument 1
1822 \begin_layout Plain Layout
1823 onclick={app.alert("Why do you click this?")}
1832 textcolor{red}{Don't click on this button!!!}}
1840 \begin_layout Standard
1841 \begin_inset VSpace defskip
1845 \begin_inset Note Greyedout
1848 \begin_layout Plain Layout
1861 has no effect for push, submit and reset buttons.
1869 \begin_layout Standard
1870 As workaround use the command
1876 as described in sec.
1877 \begin_inset space \thinspace{}
1881 \begin_inset Quotes eld
1885 \begin_inset Quotes erd
1898 that is used is used in the scheme
1899 \begin_inset Newline newline
1906 textcolor{color}{characters to color}
1909 \begin_inset Newline newline
1912 In the button above this code was used:
1913 \begin_inset Newline newline
1922 textcolor{red}{Don't click on this button!!!}}
1925 \begin_layout Standard
1926 \begin_inset Note Greyedout
1929 \begin_layout Plain Layout
1942 has no effect for push, submit and reset buttons.
1950 \begin_layout Standard
1951 As workaround use the box method described in sec.
1952 \begin_inset space \thinspace{}
1956 \begin_inset CommandInset ref
1958 reference "sub:Action-button-customization"
1965 \begin_layout Itemize
1966 Submit button without border, with cyan background color and increased height:
1967 \begin_inset VSpace defskip
1971 \begin_inset Newline newline
1975 \begin_inset Flex SubmitButton
1978 \begin_layout Plain Layout
1979 \begin_inset Argument 1
1982 \begin_layout Plain Layout
1996 centering Send your data via mail}}
2002 \begin_inset VSpace bigskip
2008 \begin_layout Itemize
2009 Reset button with a width of 7
2010 \begin_inset space \thinspace{}
2014 \begin_inset VSpace defskip
2018 \begin_inset Newline newline
2022 \begin_inset Flex ResetButton
2025 \begin_layout Plain Layout
2026 \begin_inset Argument 1
2029 \begin_layout Plain Layout
2037 makebox[7cm]{Reset the form}
2045 \begin_layout Section
2046 PDF viewer action buttons
2049 \begin_layout Standard
2050 One often needs basic actions to be done by the PDF viewer program.
2051 For example to print the form.
2052 Such PDF program-specific actions can be triggered by adding inserting
2058 The PDF viewer programs
2066 can handle all possible actions while other PDF viewers might only support
2068 However, all PDF viewer programs support the basic things like printing,
2070 \begin_inset space ~
2073 as, view in fullscreen etc..
2076 \begin_layout Standard
2077 To specify the action insert its name to the
2082 A list with possible actions can be found in sec.
2083 \begin_inset space \thinspace{}
2087 \begin_inset Quotes eld
2090 Acrobat-specific behavior
2091 \begin_inset Quotes erd
2094 of the documentation of the LaTeX package
2099 \begin_inset CommandInset citation
2108 \begin_layout Standard
2109 Here are some examples:
2112 \begin_layout Description
2114 \begin_inset Flex PDFAction
2117 \begin_layout Plain Layout
2118 \begin_inset Argument 1
2121 \begin_layout Plain Layout
2135 \begin_layout Description
2137 \begin_inset space ~
2141 \begin_inset Flex PDFAction
2144 \begin_layout Plain Layout
2145 \begin_inset Argument 1
2148 \begin_layout Plain Layout
2162 \begin_layout Description
2164 \begin_inset space ~
2168 \begin_inset space ~
2172 \begin_inset Flex PDFAction
2175 \begin_layout Plain Layout
2176 \begin_inset Argument 1
2179 \begin_layout Plain Layout
2185 View the form in fullscreen
2193 \begin_layout Subsection
2194 Action button customization
2195 \begin_inset CommandInset label
2197 name "sub:Action-button-customization"
2204 \begin_layout Standard
2205 Customizing the action buttons requires some complicated LaTeX code because
2206 things like the width, height and border separation cannot be specified
2207 as button parameters.
2210 \begin_layout Standard
2211 The easiest way to customize the buttons is to fill it with a custom box:
2214 \begin_layout Enumerate
2215 Create a normal LyX box of your choice
2218 \begin_layout Enumerate
2221 View\SpecialChar \menuseparator
2223 \begin_inset space ~
2228 to show the source code window (if not already shown)
2231 \begin_layout Enumerate
2232 set the cursor into the box and copy the corresponding LaTeX code from the
2236 \begin_layout Enumerate
2237 paste it t the content of the
2244 \begin_layout Standard
2245 For example the button should be 4
2246 \begin_inset space \thinspace{}
2249 cm wide and have the height of 2 lines.
2250 Then create this parbox:
2251 \begin_inset Newline newline
2255 \begin_inset Box Frameless
2265 height_special "totalheight"
2268 \begin_layout Plain Layout
2276 \begin_inset Newline newline
2279 and copy its LaTeX code to the button
2284 To center the text in the button add
2286 centering right before the button text.
2290 \begin_layout Standard
2291 \begin_inset Flex PDFAction
2294 \begin_layout Plain Layout
2295 \begin_inset Argument 1
2298 \begin_layout Plain Layout
2310 centering Save form as}
2318 \begin_layout Standard
2319 To customize the border color, add the command
2321 menubordercolor={r g b}
2323 to the additional options in the document settings under
2326 \begin_inset space ~
2343 with a number between 0 and 1 for the colors red, green and blue.
2344 If you want to change the border color only for certain buttons, use the
2348 \begin_inset space ~
2352 \begin_inset space ~
2357 before the button and insert there the command
2362 The default value of
2373 \begin_layout PDF Link Setup
2374 menubordercolor={0.1 0.9 0.5}
2377 \begin_layout Standard
2380 menubordercolor={0.1 0.9 0.5}
2383 \begin_inset Newline newline
2387 \begin_inset Flex PDFAction
2390 \begin_layout Plain Layout
2391 \begin_inset Argument 1
2394 \begin_layout Plain Layout
2406 centering Save form as}
2414 \begin_layout Standard
2415 To change the border width use the command
2423 is the width in pixels.
2424 The default value of
2435 \begin_layout Standard
2436 \begin_inset Note Greyedout
2439 \begin_layout Plain Layout
2448 affects all link types, not only the menu links.
2456 \begin_layout PDF Link Setup
2457 pdfborder={0 0 4}, menubordercolor={1 1 0}
2460 \begin_layout Standard
2462 \begin_inset space ~
2465 pixel thick yellow border:
2466 \begin_inset Newline newline
2470 \begin_inset Flex PDFAction
2473 \begin_layout Plain Layout
2474 \begin_inset Argument 1
2477 \begin_layout Plain Layout
2489 centering Save form as}
2497 \begin_layout Standard
2498 To change the background color insert the command
2504 at the beginning of the button inset and a
2513 is hereby the name of the color as described in sec.
2514 \begin_inset space \thinspace{}
2518 \begin_inset Quotes eld
2522 \begin_inset Quotes erd
2532 \begin_layout PDF Link Setup
2536 \begin_layout Standard
2537 An example without a border and with a background color:
2538 \begin_inset Newline newline
2542 \begin_inset Flex PDFAction
2545 \begin_layout Plain Layout
2546 \begin_inset Argument 1
2549 \begin_layout Plain Layout
2563 centering Save form as}}
2571 \begin_layout PDF Link Setup
2572 pdfborder={0 0 1}, menubordercolor={1 0 0}
2575 \begin_layout Section
2579 \begin_layout Standard
2580 It is also possible to have dynamic form fields.
2581 This means that depending on the actions of the user fields can (dis)appear
2582 or change their appearance.
2583 To use this feature, add these lines to your document preamble:
2586 \begin_layout Standard
2591 usepackage[pdftex]{insdljs}
2592 \begin_inset Newline newline
2606 \begin_layout Standard
2607 Then add the necessary JavaScript code to your document LaTeX preamble or
2608 as TeX code to your document.
2609 For info about JavaScript, see its documentation,
2610 \begin_inset CommandInset citation
2619 \begin_layout Standard
2623 \begin_layout Plain Layout
2633 \begin_inset Note Note
2636 \begin_layout Plain Layout
2637 The following section will only be displayed when the LaTeX package
2649 \begin_layout Standard
2650 For the following choice menu this JavaScript code was used:
2653 \begin_layout Standard
2654 \begin_inset listings
2655 lstparams "language=TeX"
2659 \begin_layout Plain Layout
2663 begin{insDLJS}[exaaae]{exaaae}{JavaScript}
2666 \begin_layout Plain Layout
2668 function validateTime(){
2671 \begin_layout Plain Layout
2676 \begin_layout Plain Layout
2678 if((event.value == "u") || (event.value == "unlimited")) {
2681 \begin_layout Plain Layout
2683 this.getField("from").display = display.hidden;
2686 \begin_layout Plain Layout
2688 this.getField("to").display = display.hidden;
2691 \begin_layout Plain Layout
2696 \begin_layout Plain Layout
2698 this.getField("from").display = display.visible;
2701 \begin_layout Plain Layout
2703 this.getField("to").display = display.visible;
2706 \begin_layout Plain Layout
2708 this.getField("from").setFocus();
2711 \begin_layout Plain Layout
2716 \begin_layout Plain Layout
2721 \begin_layout Plain Layout
2726 \begin_layout Plain Layout
2738 \begin_layout Standard
2739 \begin_inset Note Greyedout
2742 \begin_layout Plain Layout
2751 JavaScript funtions must be inserted into the same
2763 \begin_layout Standard
2767 \begin_inset space ~
2771 \begin_inset space ~
2776 of the following choice menu are
2777 \begin_inset Newline newline
2782 name=contract,radio,default=tl,validate={validateTime();}
2785 \begin_layout Standard
2786 \begin_inset Flex ChoiceMenu
2789 \begin_layout Plain Layout
2790 \begin_inset Argument 1
2793 \begin_layout Plain Layout
2794 name=contract,radio,default=tl,validate={validateTime();}
2799 term-limited=tl, unlimited=u
2800 \begin_inset Argument 2
2803 \begin_layout Plain Layout
2815 \begin_inset VSpace defskip
2821 \begin_layout Standard
2822 \begin_inset Tabular
2823 <lyxtabular version="3" rows="3" columns="2">
2824 <features rotate="0" tabularvalignment="middle">
2825 <column alignment="left" valignment="top">
2826 <column alignment="center" valignment="top">
2828 <cell alignment="left" valignment="top" usebox="none">
2831 \begin_layout Plain Layout
2837 <cell alignment="center" valignment="top" usebox="none">
2840 \begin_layout Plain Layout
2841 \begin_inset Flex TextField
2844 \begin_layout Plain Layout
2845 \begin_inset Argument 1
2848 \begin_layout Plain Layout
2849 name=from,width=10em
2866 <cell alignment="center" valignment="top" usebox="none">
2869 \begin_layout Plain Layout
2875 <cell alignment="center" valignment="top" usebox="none">
2878 \begin_layout Plain Layout
2879 \begin_inset VSpace -1.5mm
2889 <cell alignment="left" valignment="top" usebox="none">
2892 \begin_layout Plain Layout
2898 <cell alignment="center" valignment="top" usebox="none">
2901 \begin_layout Plain Layout
2902 \begin_inset Flex TextField
2905 \begin_layout Plain Layout
2906 \begin_inset Argument 1
2909 \begin_layout Plain Layout
2933 \begin_layout Standard
2934 \begin_inset VSpace bigskip
2940 \begin_layout Standard
2941 To check and assure that the user only enters a number to a text field you
2942 can for example use this JavaScript code:
2945 \begin_layout Standard
2946 \begin_inset listings
2947 lstparams "language=TeX"
2951 \begin_layout Plain Layout
2953 function checkNumber() {
2956 \begin_layout Plain Layout
2961 \begin_layout Plain Layout
2963 if (!Number(event.value)) {
2966 \begin_layout Plain Layout
2968 app.alert("Value must be a number!");
2971 \begin_layout Plain Layout
2976 \begin_layout Plain Layout
2981 \begin_layout Plain Layout
2983 event.target.textColor = color.green;
2986 \begin_layout Plain Layout
2996 \begin_layout Standard
2997 An example text field:
2998 \begin_inset Flex TextField
3001 \begin_layout Plain Layout
3002 \begin_inset Argument 1
3005 \begin_layout Plain Layout
3006 name=onlyNumbers, align=1, validate={checkNumber();}
3019 \begin_layout Standard
3023 \begin_layout Plain Layout
3033 \begin_inset Note Note
3036 \begin_layout Plain Layout
3037 The following will be displayed when the LaTeX package
3049 \begin_layout Standard
3050 You need to install the package
3054 to see the content of this section in the output.
3057 \begin_layout Standard
3061 \begin_layout Plain Layout
3073 \begin_layout End PDF Form
3074 \begin_inset Note Note
3077 \begin_layout Plain Layout
3086 \begin_layout Section
3087 General notes and hints
3090 \begin_layout Itemize
3091 Submitting and applying data requires that all form fields have a name.
3094 \begin_layout Itemize
3095 All braces and brackets in form parameters must be inserted as TeX code!
3098 \begin_layout Itemize
3099 It is not possible to create a PDF form using XeTeX.
3100 Use either the LyX export formats
3111 \begin_layout Itemize
3112 To be able to use all kinds of colors and color definitions you must load
3117 in the document preamble this way:
3118 \begin_inset Newline newline
3125 usepackage[svgnames,rgb]{xcolor}
3128 \begin_layout Itemize
3137 custom background colors you must disable in these programs to highlight
3138 the available form fields in the PDF.
3141 \begin_layout Bibliography
3142 \begin_inset CommandInset bibitem
3143 LatexCommand bibitem
3149 \begin_inset CommandInset href
3151 name "JavaScript reference"
3152 target "https://developer.mozilla.org/en/docs/Web/JavaScript/Reference"
3159 \begin_layout Bibliography
3160 \begin_inset CommandInset bibitem
3161 LatexCommand bibitem
3167 \begin_inset CommandInset href
3169 name "Documentation"
3170 target "http://mirrors.ctan.org/macros/latex/contrib/hyperref/doc/manual.pdf"
3174 of the LaTeX package
3179 \begin_layout Bibliography
3180 \begin_inset CommandInset bibitem
3181 LatexCommand bibitem
3187 \begin_inset CommandInset href
3189 name "Documentation"
3190 target "http://mirrors.ctan.org/macros/latex/required/psnfss/psnfss2e.pdf"
3194 of the LaTeX package