1 #LyX 2.2 created this file. For more info see http://www.lyx.org/
5 \origin /systemlyxdir/examples/
8 % used to check for needed LaTeX packages
11 % check for package insdljs
12 % used for JavScript code
14 \IfFileExists{insdljs.sty}
15 {\usepackage[pdftex]{insdljs}
16 \setboolean{insdljs}{true}}
17 {\setboolean{insdljs}{false}}
19 \pdfcatalog{/AA \the\pdflastobj\space 0 R}
21 \ifinsdljs % only execute if package insdljs is installed
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;
58 % set fonts for nicer pdf view
59 \IfFileExists{lmodern.sty}
60 {\usepackage{lmodern}}{}
62 \fi % end if pdflatex is used
64 \options BCOR8mm,pagesize
65 \use_default_options false
69 \maintain_unincluded_children false
71 \language_package default
74 \font_roman "default" "default"
75 \font_sans "default" "default"
76 \font_typewriter "default" "default"
77 \font_math "auto" "auto"
78 \font_default_family default
79 \use_non_tex_fonts false
82 \font_sf_scale 100 100
83 \font_tt_scale 100 100
85 \default_output_format pdf2
87 \bibtex_command bibtex
88 \index_command default
92 \pdf_title "Description of the module pdfcomment"
93 \pdf_author "Uwe Stöhr"
94 \pdf_subject "PDF form"
95 \pdf_keywords "LyX, PDF forms, hyperref"
97 \pdf_bookmarksnumbered true
98 \pdf_bookmarksopen true
99 \pdf_bookmarksopenlevel 2
100 \pdf_breaklinks false
102 \pdf_colorlinks false
104 \pdf_pdfusetitle false
105 \pdf_quoted_options "linkcolor=black, citecolor=black, urlcolor=blue, filecolor=blue, pdfpagelayout=OneColumn, pdfnewwindow=true, pdfstartview=XYZ, plainpages=false, urlbordercolor={1 0 0}"
108 \use_package amsmath 1
109 \use_package amssymb 1
110 \use_package cancel 0
112 \use_package mathdots 1
113 \use_package mathtools 1
114 \use_package mhchem 1
115 \use_package stackrel 0
116 \use_package stmaryrd 0
117 \use_package undertilde 0
119 \cite_engine_type default
123 \paperorientation portrait
127 \notefontcolor #0000ff
134 \paragraph_separation skip
136 \quotes_language english
139 \paperpagestyle default
140 \tracking_changes false
141 \output_changes false
144 \html_be_strict false
149 \begin_layout Begin PDF Form
150 \begin_inset Argument 1
153 \begin_layout Plain Layout
154 action=mailto:forms@lyx.test?subject=The submitted PDF form, method=post
163 Description of the module PDF Form
170 \begin_layout Standard
171 \begin_inset Note Note
174 \begin_layout Plain Layout
175 To export all parts of this document to PDF the \SpecialChar LaTeX
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 \SpecialChar LyX
230 's dropdown menu at the beginning of the document.
231 If only a part of the document should be a form, add
243 at the position where the form should start.
246 \begin_layout Standard
247 \begin_inset Note Greyedout
250 \begin_layout Plain Layout
255 It is only possible to have one form in a PDF file!
263 \begin_layout Standard
264 If the form data should be submitted to a server or the like, then you must
265 specify the URL as parameter of the
278 This is done by using the menu
280 Insert\SpecialChar menuseparator
292 For example in this document the following was inserted to the parameter
296 \begin_layout Standard
299 action=mailto:forms@lyx.test?subject=The submitted PDF form,
300 \begin_inset Newline newline
306 \begin_layout Standard
307 This sends the form data as email to
311 when the user presses the submit button.
312 The email subject will be
313 \begin_inset Quotes eld
316 The submitted PDF form
317 \begin_inset Quotes erd
320 and the HTML method is
325 (The other possible method would be
329 .) For more about submitting see sec.
330 \begin_inset space \thinspace{}
334 \begin_inset CommandInset ref
336 reference "subsec:Submit-button"
343 \begin_layout Standard
344 \begin_inset Newpage newpage
350 \begin_layout Section
354 \begin_layout Standard
359 possible types of fields in a PDF form:
362 \begin_layout Subsection
366 \begin_layout Standard
367 A text field is added by inserting the custom inset
373 Insert\SpecialChar menuseparator
381 Write inside the inset the label for the text field that will be printed
382 in the PDF output before the field.
384 \begin_inset Newline newline
388 \begin_inset Flex TextField
391 \begin_layout Plain Layout
392 \begin_inset Argument 1
395 \begin_layout Plain Layout
401 Enter your name here:
409 \begin_layout Standard
410 You must also specify a field name for text fields: Set the cursor into
416 There insert for example the parameter
427 \begin_layout Standard
428 Using the same name for several text fields results in an automatic duplication
429 of the inserted text.
430 This is for example useful if the user should input a date that should
431 appear at different places in the form.
432 \begin_inset Newline newline
439 fields as example: Fill one and see that the other one will also be filled
441 \begin_inset Newline newline
445 \begin_inset Flex TextField
448 \begin_layout Plain Layout
449 \begin_inset Argument 1
452 \begin_layout Plain Layout
464 \begin_inset Newline newline
468 \begin_inset Flex TextField
471 \begin_layout Plain Layout
472 \begin_inset Argument 1
475 \begin_layout Plain Layout
489 \begin_layout Standard
490 All form fields can be customized by adding parameters.
493 \begin_layout Standard
494 Here is a customized multiline text field with a width of 60
495 \begin_inset space \thinspace{}
498 % of the text width, 3
499 \begin_inset space \thinspace{}
502 cm height and a proposed content:
503 \begin_inset VSpace defskip
507 \begin_inset Newline newline
511 \begin_inset Flex TextField
514 \begin_layout Plain Layout
515 \begin_inset Argument 1
518 \begin_layout Plain Layout
519 name=customer2, multiline, width=0.6
521 textwidth, height=3cm, value={Testman}
526 Enter your name here:
534 \begin_layout Standard
535 \begin_inset Note Greyedout
538 \begin_layout Plain Layout
543 It is highly recommended to use a uniform layout of all fields in your
546 \begin_inset space \thinspace{}
550 \begin_inset CommandInset ref
552 reference "sec:Form-field-customization"
556 for how this is done.
564 \begin_layout Subsection
568 \begin_layout Standard
569 A check box is added by inserting the custom inset
574 Write inside the inset the label for the box.
576 \begin_inset Newline newline
580 \begin_inset Flex CheckBox
583 \begin_layout Plain Layout
584 \begin_inset Argument 1
587 \begin_layout Plain Layout
593 Are you older than 18 years?
601 \begin_layout Standard
602 You must also specify a field name for check boxes: Insert for example the
611 is the field name) into the
618 \begin_layout Subsection
622 \begin_layout Standard
623 A choice menu is added by inserting the custom inset
628 A label for the inset is added by using the menu
630 Insert\SpecialChar menuseparator
634 Insert the label text into this inset.
635 \begin_inset Newline newline
638 The different choices are inserted to the inset as comma-separated list.
646 \begin_layout Description
647 Radio Only one choice can be selected
650 \begin_layout Description
651 Combo The choices are listed in a combo box (dropdown list) but the user
652 is allowed to choose something that is not in the predefined list.
655 \begin_layout Description
656 Popdown All choices are listed below each other.
657 It the filed is not high enough a scroll bar is automatically added to
661 \begin_layout Standard
662 To determine the choice menu type, add the parameter
677 \begin_layout Standard
678 Here is an example for the radio type:
679 \begin_inset VSpace defskip
683 \begin_inset Newline newline
687 \begin_inset Flex ChoiceMenu
690 \begin_layout Plain Layout
691 \begin_inset Argument 1
694 \begin_layout Plain Layout
701 \begin_inset Argument 2
704 \begin_layout Plain Layout
718 \begin_layout Standard
719 Here is an example for the combo type:
720 \begin_inset VSpace defskip
724 \begin_inset Newline newline
728 \begin_inset Flex ChoiceMenu
731 \begin_layout Plain Layout
732 \begin_inset Argument 1
735 \begin_layout Plain Layout
741 Albania=Al, Armenia=Ar, Azerbaidschan=Az
742 \begin_inset Argument 2
745 \begin_layout Plain Layout
759 \begin_layout Standard
760 Here is an example for the popdown type:
761 \begin_inset VSpace defskip
765 \begin_inset Newline newline
769 \begin_inset Flex ChoiceMenu
772 \begin_layout Plain Layout
773 \begin_inset Argument 1
776 \begin_layout Plain Layout
777 popdown, name=country
782 Albania=Al, Armenia=Ar, Azerbaidschan=Az
783 \begin_inset Argument 2
786 \begin_layout Plain Layout
800 \begin_layout Standard
801 You must also specify a field name for choice menus: Insert for example
810 is the field name) into the
817 \begin_layout Standard
818 It is recommended to add a short name for every choice to be able to access
819 them and to know which one was chosen by the user.
820 This is done by adding
824 behind each choice (where
829 For example the radio type example contains this choice list:
835 \begin_inset Quotes eld
839 \begin_inset Quotes erd
842 you know that he chose the choice
843 \begin_inset Quotes eld
847 \begin_inset Quotes erd
851 By specifying names you can also preset/propose e.g.
852 \begin_inset space \space{}
856 \begin_inset Quotes eld
860 \begin_inset Quotes erd
863 by adding the parameter
871 \begin_layout Standard
872 \begin_inset Flex ChoiceMenu
875 \begin_layout Plain Layout
876 \begin_inset Argument 1
879 \begin_layout Plain Layout
880 radio, name=sex, default=m
886 \begin_inset Argument 2
889 \begin_layout Plain Layout
903 \begin_layout Standard
904 \begin_inset Note Greyedout
907 \begin_layout Plain Layout
912 Due to a bug in the \SpecialChar LaTeX
917 it is currently only possible the set the first choice as default.
925 \begin_layout Standard
926 \begin_inset Newpage newpage
932 \begin_layout Subsection
936 \begin_layout Standard
937 A push button is added by inserting the custom inset
942 Write inside the inset the label for the button.
946 \begin_layout Standard
947 \begin_inset Flex PushButton
950 \begin_layout Plain Layout
951 \begin_inset Argument 1
954 \begin_layout Plain Layout
960 Don't click on this button or your fridge will be destroyed!!!
968 \begin_layout Standard
969 The action that is triggered by pressing the button is specified by JavaScript
971 To specify it, add the parameter
975 and insert the JavaScript code between the braces.
976 For info about JavaScript, see its documentation,
977 \begin_inset CommandInset citation
984 In the following example this JavaScript code was used:
985 \begin_inset Newline newline
994 \begin_layout Plain Layout
1001 What the hell? Now you destroyed your fridge.
1006 \begin_layout Plain Layout
1016 \begin_layout Standard
1017 \begin_inset Flex PushButton
1020 \begin_layout Plain Layout
1021 \begin_inset Argument 1
1024 \begin_layout Plain Layout
1029 \begin_layout Plain Layout
1036 What the hell? Now you destroyed your fridge.
1041 \begin_layout Plain Layout
1053 Don't click on this button or your fridge will be destroyed!!!
1061 \begin_layout Standard
1062 \begin_inset Note Greyedout
1065 \begin_layout Plain Layout
1070 All quote characters in form parameters must be inserted as \SpecialChar TeX
1079 \begin_layout Standard
1080 A common usage for pus buttons is to open a weblink.
1081 Such a button is created by inserting a hyperlink into the button inset.
1085 \begin_layout Standard
1086 \begin_inset Flex PushButton
1089 \begin_layout Plain Layout
1090 \begin_inset Argument 1
1093 \begin_layout Plain Layout
1100 \begin_inset CommandInset href
1102 name "Information how to fill out this form"
1103 target "http://wiki.lyx.org"
1115 \begin_layout Standard
1116 To get rid of the frame for weblinks add this to the additional options
1117 in the document settings under
1120 \begin_inset space ~
1128 \begin_layout Standard
1131 urlbordercolor={1 0 0}
1134 \begin_layout Standard
1135 if your push button border color is red (the default), otherwise use the
1136 same color definition as for your push button border color.
1139 \begin_layout Subsection
1141 \begin_inset CommandInset label
1143 name "subsec:Submit-button"
1150 \begin_layout Standard
1151 A submit button is used to submit the form data to a server.
1152 It is added by inserting the custom inset
1157 Write inside the inset the label for the button.
1161 \begin_layout Standard
1162 \begin_inset Flex SubmitButton
1165 \begin_layout Plain Layout
1166 \begin_inset Argument 1
1169 \begin_layout Plain Layout
1175 Send your data via email
1183 \begin_layout Standard
1184 The submit button creates a forms data format (FDF) file (file extension
1185 *.fdf) which is then submitted.
1186 The FDF file contains only the form data.
1187 They can only be applied to a PDF form if all fields in the form have a
1191 \begin_layout Standard
1192 \begin_inset Note Greyedout
1195 \begin_layout Plain Layout
1200 You can only use a submit button if you specified the submit method and
1201 target in the PDF form environment options! See sec.
1202 \begin_inset space \thinspace{}
1206 \begin_inset CommandInset ref
1208 reference "sec:Preparation"
1212 for the description.
1213 If there are no specifications you will get \SpecialChar LaTeX
1222 \begin_layout Standard
1223 \begin_inset Note Greyedout
1226 \begin_layout Plain Layout
1231 If you have more than one submit button in your document you must specify
1232 a name for each of them to avoid \SpecialChar LaTeX
1233 errors! For example add
1241 is the button name).
1249 \begin_layout Subsection
1253 \begin_layout Standard
1254 A reset button is used to reset all form fields to the initial state.
1255 It is added by inserting the custom inset
1260 Write inside the inset the label for the button.
1264 \begin_layout Standard
1265 \begin_inset Flex ResetButton
1268 \begin_layout Plain Layout
1269 \begin_inset Argument 1
1272 \begin_layout Plain Layout
1286 \begin_layout Standard
1287 \begin_inset Note Greyedout
1290 \begin_layout Plain Layout
1295 If you have more than one reset button in your document you must specify
1296 a name for each of them to avoid \SpecialChar LaTeX
1297 errors! For example add
1305 is the button name).
1313 \begin_layout Section
1314 Form field customization
1315 \begin_inset CommandInset label
1317 name "sec:Form-field-customization"
1324 \begin_layout Standard
1325 Since all form elements should look uniform, one can determine their layout
1326 using the following styles:
1329 \begin_layout Description
1331 \begin_inset space ~
1335 \begin_inset space ~
1341 \begin_layout Description
1343 \begin_inset space ~
1347 \begin_inset space ~
1353 \begin_layout Description
1355 \begin_inset space ~
1359 \begin_inset space ~
1362 Style affects all choice menu types
1365 \begin_layout Description
1367 \begin_inset space ~
1371 \begin_inset space ~
1374 Style affects only the combo box style
1377 \begin_layout Description
1379 \begin_inset space ~
1383 \begin_inset space ~
1386 Style affects only the popdown box style
1389 \begin_layout Description
1391 \begin_inset space ~
1395 \begin_inset space ~
1398 Style affects only the radio box style
1401 \begin_layout Description
1403 \begin_inset space ~
1407 \begin_inset space ~
1413 \begin_layout Description
1415 \begin_inset space ~
1419 \begin_inset space ~
1425 \begin_layout Description
1427 \begin_inset space ~
1431 \begin_inset space ~
1437 \begin_layout Text Field Style
1441 \begin_layout Standard
1442 The content of the styles is a comma-separated list of parameters.
1443 The possible parameters are listed in sec.
1444 \begin_inset space \thinspace{}
1448 \begin_inset Quotes eld
1451 Forms optional parameters
1452 \begin_inset Quotes erd
1455 of the documentation of the \SpecialChar LaTeX
1461 \begin_inset CommandInset citation
1468 It is important that the parameter print is always part of the definition,
1469 otherwise the fields won't appear in the PDF output.
1470 The defined style is applied to all fields following the definition.
1473 \begin_layout Subsubsection*
1474 Here are some examples:
1477 \begin_layout Text Field Style
1478 print, bordercolor=red, borderstyle=U, backgroundcolor=lightgray, color=lime,
1479 maxlen=10, align=2, charsize=16pt
1482 \begin_layout Check Box Style
1483 print, borderstyle=S, checkboxsymbol=
1488 \begin_layout Combo Box Style
1489 print, bordercolor={0.33 0.66 0.33}, borderstyle=D
1492 \begin_layout Popdown Box Style
1496 \begin_layout Radio Box Style
1497 print, borderstyle=I, radiosymbol=6
1500 \begin_layout Push Button Style
1501 print, borderstyle=B, bordercolor=lime
1504 \begin_layout Submit Button Style
1505 print, borderwidth=0, bordercolor=white
1508 \begin_layout Reset Button Style
1509 print, bordercolor=lime
1512 \begin_layout Itemize
1513 Text field with gray background, lime text color, a red border only below
1514 the field, right alignment, 16
1515 \begin_inset space \thinspace{}
1518 pt font size and a limitation for maximal 10
1519 \begin_inset space ~
1522 characters to insert:
1523 \begin_inset VSpace defskip
1527 \begin_inset Newline newline
1531 \begin_inset Flex TextField
1534 \begin_layout Plain Layout
1535 \begin_inset Argument 1
1538 \begin_layout Plain Layout
1544 Enter your name here:
1552 \begin_layout Standard
1580 \begin_layout Standard
1581 \begin_inset Note Greyedout
1584 \begin_layout Plain Layout
1593 has only an effect for text fields if a
1605 \begin_layout Itemize
1606 Check box with normal border and symbol
1609 \begin_inset VSpace defskip
1613 \begin_inset Newline newline
1617 \begin_inset Flex CheckBox
1620 \begin_layout Plain Layout
1621 \begin_inset Argument 1
1624 \begin_layout Plain Layout
1630 Are you older than 18 years?
1638 \begin_layout Standard
1639 The symbol is either specified as number or with the command
1640 \begin_inset Newline newline
1650 \begin_inset Newline newline
1657 is one of the possible numbers listed in Table
1658 \begin_inset space ~
1662 \begin_inset CommandInset citation
1671 \begin_layout Itemize
1672 Combo box with dashed, colored border:
1673 \begin_inset VSpace defskip
1677 \begin_inset Newline newline
1681 \begin_inset Flex ChoiceMenu
1684 \begin_layout Plain Layout
1685 \begin_inset Argument 1
1688 \begin_layout Plain Layout
1689 combo, name=combo2, default=Az
1694 Albania=Al, Armenia=Ar, Azerbaidschan=Az
1695 \begin_inset Argument 2
1698 \begin_layout Plain Layout
1712 \begin_layout Itemize
1713 Popdown box where only 2
1714 \begin_inset space ~
1717 entries are shown and where the last entry is preselected:
1718 \begin_inset VSpace defskip
1722 \begin_inset Newline newline
1726 \begin_inset Flex ChoiceMenu
1729 \begin_layout Plain Layout
1730 \begin_inset Argument 1
1733 \begin_layout Plain Layout
1734 popdown, name=country2, value=Az
1739 Albania=Al, Armenia=Ar, Azerbaidschan=Az
1740 \begin_inset Argument 2
1743 \begin_layout Plain Layout
1757 \begin_layout Standard
1758 \begin_inset VSpace defskip
1762 \begin_inset Note Greyedout
1765 \begin_layout Plain Layout
1782 has no effect for popdown boxes.
1790 \begin_layout Itemize
1791 Radio box with inverted bevel border and symbol number
1792 \begin_inset space ~
1796 \begin_inset VSpace defskip
1800 \begin_inset Newline newline
1804 \begin_inset Flex ChoiceMenu
1807 \begin_layout Plain Layout
1808 \begin_inset Argument 1
1811 \begin_layout Plain Layout
1818 \begin_inset Argument 2
1821 \begin_layout Plain Layout
1835 \begin_layout Itemize
1836 Push button with a bevel border and colored text:
1837 \begin_inset VSpace defskip
1841 \begin_inset Newline newline
1845 \begin_inset Flex PushButton
1848 \begin_layout Plain Layout
1849 \begin_inset Argument 1
1852 \begin_layout Plain Layout
1857 \begin_layout Plain Layout
1864 Why do you click this?
1868 \begin_layout Plain Layout
1881 \begin_inset Box Frameless
1891 height_special "totalheight"
1896 backgroundcolor "lime"
1899 \begin_layout Plain Layout
1902 Don't click on this button!!!
1915 \begin_layout Standard
1916 \begin_inset VSpace defskip
1920 \begin_inset Note Greyedout
1923 \begin_layout Plain Layout
1936 has no effect for push, submit and reset buttons.
1944 \begin_layout Standard
1945 As workaround use a colored box and/or color the box text.
1948 \begin_layout Standard
1949 \begin_inset Note Greyedout
1952 \begin_layout Plain Layout
1965 has no effect for push, submit and reset buttons.
1973 \begin_layout Standard
1974 As workaround a box.
1977 \begin_layout Itemize
1978 Submit button without border, with cyan background color and increased height:
1979 \begin_inset VSpace defskip
1983 \begin_inset Newline newline
1987 \begin_inset Flex SubmitButton
1990 \begin_layout Plain Layout
1991 \begin_inset Argument 1
1994 \begin_layout Plain Layout
2001 \begin_inset Box Frameless
2011 height_special "totalheight"
2016 backgroundcolor "cyan"
2019 \begin_layout Plain Layout
2020 Send your data via mail
2031 \begin_inset VSpace bigskip
2037 \begin_layout Itemize
2038 Reset button with a width of 7
2039 \begin_inset space \thinspace{}
2043 \begin_inset VSpace defskip
2047 \begin_inset Newline newline
2051 \begin_inset Flex ResetButton
2054 \begin_layout Plain Layout
2055 \begin_inset Argument 1
2058 \begin_layout Plain Layout
2065 \begin_inset Box Frameless
2075 height_special "totalheight"
2080 backgroundcolor "none"
2083 \begin_layout Plain Layout
2097 \begin_layout Section
2098 PDF viewer action buttons
2101 \begin_layout Standard
2102 One often needs basic actions to be done by the PDF viewer program.
2103 For example to print the form.
2104 Such PDF program-specific actions can be triggered by adding inserting
2110 The PDF viewer programs
2118 can handle all possible actions while other PDF viewers might only support
2120 However, all PDF viewer programs support the basic things like printing,
2122 \begin_inset space ~
2125 as, view in fullscreen etc..
2128 \begin_layout Standard
2129 To specify the action insert its name to the
2134 A list with possible actions can be found in sec.
2135 \begin_inset space \thinspace{}
2139 \begin_inset Quotes eld
2142 Acrobat-specific behavior
2143 \begin_inset Quotes erd
2146 of the documentation of the \SpecialChar LaTeX
2152 \begin_inset CommandInset citation
2161 \begin_layout Standard
2162 Here are some examples:
2165 \begin_layout Description
2167 \begin_inset Flex PDFAction
2170 \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 Flex PDFAction
2197 \begin_layout Plain Layout
2198 \begin_inset Argument 1
2201 \begin_layout Plain Layout
2215 \begin_layout Description
2217 \begin_inset space ~
2221 \begin_inset space ~
2225 \begin_inset Flex PDFAction
2228 \begin_layout Plain Layout
2229 \begin_inset Argument 1
2232 \begin_layout Plain Layout
2238 View the form in fullscreen
2246 \begin_layout Subsection
2247 Action button customization
2248 \begin_inset CommandInset label
2250 name "subsec:Action-button-customization"
2257 \begin_layout Standard
2258 Customizing the action buttons requires the usage of boxes because things
2259 like the width, height and border separation cannot be specified as button
2263 \begin_layout Standard
2264 The easiest way to customize the buttons is to fill it with a custom box.
2265 For example the button should be 4
2266 \begin_inset space \thinspace{}
2269 cm wide and have the height of 2 lines.
2270 Then create this parbox:
2273 \begin_layout Standard
2274 \begin_inset Box Frameless
2284 height_special "totalheight"
2289 backgroundcolor "none"
2292 \begin_layout Plain Layout
2302 \begin_layout Standard
2311 \begin_layout Standard
2312 \begin_inset Flex PDFAction
2315 \begin_layout Plain Layout
2316 \begin_inset Argument 1
2319 \begin_layout Plain Layout
2326 \begin_inset Box Frameless
2336 height_special "totalheight"
2341 backgroundcolor "none"
2344 \begin_layout Plain Layout
2358 \begin_layout Standard
2359 To customize the border color, add the command
2361 menubordercolor={r g b}
2363 to the additional options in the document settings under
2366 \begin_inset space ~
2383 with a number between 0 and 1 for the colors red, green and blue.
2384 If you want to change the border color only for certain buttons, use the
2388 \begin_inset space ~
2392 \begin_inset space ~
2397 before the button and insert there the command
2402 The default value of
2413 \begin_layout PDF Link Setup
2414 menubordercolor={0.1 0.9 0.5}
2417 \begin_layout Standard
2420 menubordercolor={0.1 0.9 0.5}
2423 \begin_inset Newline newline
2427 \begin_inset Flex PDFAction
2430 \begin_layout Plain Layout
2431 \begin_inset Argument 1
2434 \begin_layout Plain Layout
2441 \begin_inset Box Frameless
2451 height_special "totalheight"
2456 backgroundcolor "none"
2459 \begin_layout Plain Layout
2474 \begin_layout Standard
2475 To change the border width use the command
2483 is the width in pixels.
2484 The default value of
2495 \begin_layout Standard
2496 \begin_inset Note Greyedout
2499 \begin_layout Plain Layout
2508 affects all link types, not only the menu links.
2516 \begin_layout PDF Link Setup
2517 pdfborder={0 0 4}, menubordercolor={1 1 0}
2520 \begin_layout Standard
2522 \begin_inset space ~
2525 pixel thick yellow border:
2526 \begin_inset Newline newline
2530 \begin_inset Flex PDFAction
2533 \begin_layout Plain Layout
2534 \begin_inset Argument 1
2537 \begin_layout Plain Layout
2544 \begin_inset Box Frameless
2554 height_special "totalheight"
2559 backgroundcolor "none"
2562 \begin_layout Plain Layout
2577 \begin_layout Standard
2578 To change the background color use a colored box.
2581 \begin_layout PDF Link Setup
2585 \begin_layout Standard
2586 An example without a border and with lime background color:
2587 \begin_inset Newline newline
2591 \begin_inset Flex PDFAction
2594 \begin_layout Plain Layout
2595 \begin_inset Argument 1
2598 \begin_layout Plain Layout
2605 \begin_inset Box Frameless
2615 height_special "totalheight"
2620 backgroundcolor "lime"
2623 \begin_layout Plain Layout
2638 \begin_layout PDF Link Setup
2639 pdfborder={0 0 1}, menubordercolor={1 0 0}
2642 \begin_layout Section
2646 \begin_layout Standard
2647 It is also possible to have dynamic form fields.
2648 This means that depending on the actions of the user fields can (dis)appear
2649 or change their appearance.
2650 To use this feature, add these lines to your document preamble:
2653 \begin_layout Standard
2658 usepackage[pdftex]{insdljs}
2659 \begin_inset Newline newline
2673 \begin_layout Standard
2674 Then add the necessary JavaScript code to your document \SpecialChar LaTeX
2677 code to your document.
2678 For info about JavaScript, see its documentation,
2679 \begin_inset CommandInset citation
2688 \begin_layout Standard
2692 \begin_layout Plain Layout
2702 \begin_inset Note Note
2705 \begin_layout Plain Layout
2706 The following section will only be displayed when the \SpecialChar LaTeX
2719 \begin_layout Standard
2720 For the following choice menu this JavaScript code was used:
2723 \begin_layout Standard
2724 \begin_inset listings
2725 lstparams "language=TeX"
2729 \begin_layout Plain Layout
2733 begin{insDLJS}[exaaae]{exaaae}{JavaScript}
2736 \begin_layout Plain Layout
2738 function validateTime(){
2741 \begin_layout Plain Layout
2746 \begin_layout Plain Layout
2748 if((event.value == "u") || (event.value == "unlimited")) {
2751 \begin_layout Plain Layout
2753 this.getField("from").display = display.hidden;
2756 \begin_layout Plain Layout
2758 this.getField("to").display = display.hidden;
2761 \begin_layout Plain Layout
2766 \begin_layout Plain Layout
2768 this.getField("from").display = display.visible;
2771 \begin_layout Plain Layout
2773 this.getField("to").display = display.visible;
2776 \begin_layout Plain Layout
2778 this.getField("from").setFocus();
2781 \begin_layout Plain Layout
2786 \begin_layout Plain Layout
2791 \begin_layout Plain Layout
2796 \begin_layout Plain Layout
2808 \begin_layout Standard
2809 \begin_inset Note Greyedout
2812 \begin_layout Plain Layout
2821 JavaScript funtions must be inserted into the same
2833 \begin_layout Standard
2837 \begin_inset space ~
2841 \begin_inset space ~
2846 of the following choice menu are
2847 \begin_inset Newline newline
2852 name=contract,radio,default=tl,validate={validateTime();}
2855 \begin_layout Standard
2856 \begin_inset Flex ChoiceMenu
2859 \begin_layout Plain Layout
2860 \begin_inset Argument 1
2863 \begin_layout Plain Layout
2864 name=contract,radio,default=tl,validate={validateTime();}
2869 term-limited=tl, unlimited=u
2870 \begin_inset Argument 2
2873 \begin_layout Plain Layout
2885 \begin_inset VSpace defskip
2891 \begin_layout Standard
2892 \begin_inset Tabular
2893 <lyxtabular version="3" rows="3" columns="2">
2894 <features tabularvalignment="middle">
2895 <column alignment="left" valignment="top">
2896 <column alignment="center" valignment="top">
2898 <cell alignment="left" valignment="top" usebox="none">
2901 \begin_layout Plain Layout
2907 <cell alignment="center" valignment="top" usebox="none">
2910 \begin_layout Plain Layout
2911 \begin_inset Flex TextField
2914 \begin_layout Plain Layout
2915 \begin_inset Argument 1
2918 \begin_layout Plain Layout
2919 name=from,width=10em
2936 <cell alignment="center" valignment="top" usebox="none">
2939 \begin_layout Plain Layout
2945 <cell alignment="center" valignment="top" usebox="none">
2948 \begin_layout Plain Layout
2949 \begin_inset VSpace -1.5mm
2959 <cell alignment="left" valignment="top" usebox="none">
2962 \begin_layout Plain Layout
2968 <cell alignment="center" valignment="top" usebox="none">
2971 \begin_layout Plain Layout
2972 \begin_inset Flex TextField
2975 \begin_layout Plain Layout
2976 \begin_inset Argument 1
2979 \begin_layout Plain Layout
3003 \begin_layout Standard
3004 \begin_inset VSpace bigskip
3010 \begin_layout Standard
3011 To check and assure that the user only enters a number to a text field you
3012 can for example use this JavaScript code:
3015 \begin_layout Standard
3016 \begin_inset listings
3017 lstparams "language=TeX"
3021 \begin_layout Plain Layout
3023 function checkNumber() {
3026 \begin_layout Plain Layout
3031 \begin_layout Plain Layout
3033 if (!Number(event.value)) {
3036 \begin_layout Plain Layout
3038 app.alert("Value must be a number!");
3041 \begin_layout Plain Layout
3046 \begin_layout Plain Layout
3051 \begin_layout Plain Layout
3053 event.target.textColor = color.green;
3056 \begin_layout Plain Layout
3066 \begin_layout Standard
3067 An example text field:
3068 \begin_inset Flex TextField
3071 \begin_layout Plain Layout
3072 \begin_inset Argument 1
3075 \begin_layout Plain Layout
3076 name=onlyNumbers, align=1, validate={checkNumber();}
3089 \begin_layout Standard
3093 \begin_layout Plain Layout
3103 \begin_inset Note Note
3106 \begin_layout Plain Layout
3107 The following will be displayed when the \SpecialChar LaTeX
3120 \begin_layout Standard
3121 You need to install the package
3125 to see the content of this section in the output.
3128 \begin_layout Standard
3132 \begin_layout Plain Layout
3144 \begin_layout End PDF Form
3145 \begin_inset Note Note
3148 \begin_layout Plain Layout
3157 \begin_layout Section
3158 General notes and hints
3161 \begin_layout Itemize
3162 Submitting and applying data requires that all form fields have a name.
3165 \begin_layout Itemize
3166 All braces, brackets, backslashes and quote characters in form parameters
3167 must be inserted as \SpecialChar TeX
3171 \begin_layout Itemize
3172 Creating a PDF form requires pdflatex or lualatex.
3173 Use either the \SpecialChar LyX
3180 PDF (Lua\SpecialChar TeX
3186 \begin_layout Itemize
3195 custom background colors you must disable in these programs to highlight
3196 the available form fields in the PDF.
3199 \begin_layout Bibliography
3200 \begin_inset CommandInset bibitem
3201 LatexCommand bibitem
3207 \begin_inset CommandInset href
3209 name "JavaScript reference"
3210 target "https://developer.mozilla.org/en/docs/Web/JavaScript/Reference"
3217 \begin_layout Bibliography
3218 \begin_inset CommandInset bibitem
3219 LatexCommand bibitem
3225 \begin_inset CommandInset href
3227 name "Documentation"
3228 target "http://mirrors.ctan.org/macros/latex/contrib/hyperref/doc/manual.pdf"
3232 of the \SpecialChar LaTeX
3238 \begin_layout Bibliography
3239 \begin_inset CommandInset bibitem
3240 LatexCommand bibitem
3246 \begin_inset CommandInset href
3248 name "Documentation"
3249 target "http://mirrors.ctan.org/macros/latex/required/psnfss/psnfss2e.pdf"
3253 of the \SpecialChar LaTeX