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
393 \begin_inset Argument 1
396 \begin_layout Plain Layout
402 Enter your name here:
410 \begin_layout Standard
411 You must also specify a field name for text fields: Set the cursor into
417 There insert for example the parameter
428 \begin_layout Standard
429 \begin_inset Note Greyedout
432 \begin_layout Plain Layout
437 All braces, brackets, backslashes and quote characters in form parameters
438 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
468 \begin_inset Argument 1
471 \begin_layout Plain Layout
483 \begin_inset Newline newline
487 \begin_inset Flex TextField
490 \begin_layout Plain Layout
491 \begin_inset Argument 1
494 \begin_layout Plain Layout
508 \begin_layout Standard
509 All form fields can be customized by adding parameters.
512 \begin_layout Standard
513 Here is a customized multiline text field with a width of 60
514 \begin_inset space \thinspace{}
517 % of the text width, 3
518 \begin_inset space \thinspace{}
521 cm height and a proposed content:
522 \begin_inset VSpace defskip
526 \begin_inset Newline newline
530 \begin_inset Flex TextField
533 \begin_layout Plain Layout
534 \begin_inset Argument 1
537 \begin_layout Plain Layout
538 name=customer2, multiline, width=0.6
542 \begin_layout Plain Layout
555 \begin_layout Plain Layout
566 \begin_layout Plain Layout
578 Enter your name here:
586 \begin_layout Standard
587 \begin_inset Note Greyedout
590 \begin_layout Plain Layout
595 It is highly recommended to use a uniform layout of all fields in your
598 \begin_inset space \thinspace{}
602 \begin_inset CommandInset ref
604 reference "sec:Form-field-customization"
608 for how this is done.
616 \begin_layout Subsection
620 \begin_layout Standard
621 A check box is added by inserting the custom inset
626 Write inside the inset the label for the box.
628 \begin_inset Newline newline
632 \begin_inset Flex CheckBox
635 \begin_layout Plain Layout
636 \begin_inset Argument 1
639 \begin_layout Plain Layout
645 Are you older than 18 years?
653 \begin_layout Standard
654 You must also specify a field name for check boxes: Insert for example the
663 is the field name) into the
670 \begin_layout Subsection
674 \begin_layout Standard
675 A choice menu is added by inserting the custom inset
680 A label for the inset is added by using the menu
682 Insert\SpecialChar \menuseparator
686 Insert the label text into this inset.
687 \begin_inset Newline newline
690 The different choices are inserted to the inset as comma-separated list.
698 \begin_layout Description
699 Radio Only one choice can be selected
702 \begin_layout Description
703 Combo The choices are listed in a combo box (dropdown list) but the user
704 is allowed to choose something that is not in the predefined list.
707 \begin_layout Description
708 Popdown All choices are listed below each other.
709 It the filed is not high enough a scroll bar is automatically added to
713 \begin_layout Standard
714 To determine the choice menu type, add the parameter
729 \begin_layout Standard
730 Here is an example for the radio type:
731 \begin_inset VSpace defskip
735 \begin_inset Newline newline
739 \begin_inset Flex ChoiceMenu
742 \begin_layout Plain Layout
743 \begin_inset Argument 1
746 \begin_layout Plain Layout
753 \begin_inset Argument 2
756 \begin_layout Plain Layout
770 \begin_layout Standard
771 Here is an example for the combo type:
772 \begin_inset VSpace defskip
776 \begin_inset Newline newline
780 \begin_inset Flex ChoiceMenu
783 \begin_layout Plain Layout
784 \begin_inset Argument 1
787 \begin_layout Plain Layout
793 Albania=Al, Armenia=Ar, Azerbaidschan=Az
794 \begin_inset Argument 2
797 \begin_layout Plain Layout
811 \begin_layout Standard
812 Here is an example for the popdown type:
813 \begin_inset VSpace defskip
817 \begin_inset Newline newline
821 \begin_inset Flex ChoiceMenu
824 \begin_layout Plain Layout
825 \begin_inset Argument 1
828 \begin_layout Plain Layout
829 popdown, name=country
834 Albania=Al, Armenia=Ar, Azerbaidschan=Az
835 \begin_inset Argument 2
838 \begin_layout Plain Layout
852 \begin_layout Standard
853 You must also specify a field name for choice menus: Insert for example
862 is the field name) into the
869 \begin_layout Standard
870 It is recommended to add a short name for every choice to be able to access
871 them and to know which one was chosen by the user.
872 This is done by adding
876 behind each choice (where
881 For example the radio type example contains this choice list:
887 \begin_inset Quotes eld
891 \begin_inset Quotes erd
894 you know that he chose the choice
895 \begin_inset Quotes eld
899 \begin_inset Quotes erd
903 By specifying names you can also preset/propose e.g.
904 \begin_inset space \space{}
908 \begin_inset Quotes eld
912 \begin_inset Quotes erd
915 by adding the parameter
923 \begin_layout Standard
924 \begin_inset Flex ChoiceMenu
927 \begin_layout Plain Layout
928 \begin_inset Argument 1
931 \begin_layout Plain Layout
932 radio, name=sex, default=m
938 \begin_inset Argument 2
941 \begin_layout Plain Layout
955 \begin_layout Standard
956 \begin_inset Note Greyedout
959 \begin_layout Plain Layout
964 Due to a bug in the LaTeX package
968 it is currently only possible the set the first choice as default.
976 \begin_layout Standard
977 \begin_inset Newpage newpage
983 \begin_layout Subsection
987 \begin_layout Standard
988 A push button is added by inserting the custom inset
993 Write inside the inset the label for the button.
997 \begin_layout Standard
998 \begin_inset Flex PushButton
1001 \begin_layout Plain Layout
1002 \begin_inset Argument 1
1005 \begin_layout Plain Layout
1011 Don't click on this button or your fridge will be destroyed!!!
1019 \begin_layout Standard
1020 The action that is triggered by pressing the button is specified by JavaScript
1022 To specify it, add the parameter
1026 and insert the JavaScript code between the braces.
1029 \begin_layout Standard
1030 \begin_inset Flex PushButton
1033 \begin_layout Plain Layout
1034 \begin_inset Argument 1
1037 \begin_layout Plain Layout
1042 \begin_layout Plain Layout
1053 \begin_layout Plain Layout
1060 What the hell? Now you destroyed your fridge.
1065 \begin_layout Plain Layout
1076 \begin_layout Plain Layout
1088 Don't click on this button or your fridge will be destroyed!!!
1096 \begin_layout Standard
1097 For info about JavaScript, see its documentation,
1098 \begin_inset CommandInset citation
1107 \begin_layout Standard
1108 A common usage for pus buttons is to open a weblink.
1109 Such a button is created by inserting a hyperlink into the button inset.
1113 \begin_layout Standard
1114 \begin_inset Flex PushButton
1117 \begin_layout Plain Layout
1118 \begin_inset Argument 1
1121 \begin_layout Plain Layout
1128 \begin_inset CommandInset href
1130 name "Information how to fill out this form"
1131 target "http://wiki.lyx.org"
1143 \begin_layout Standard
1144 To get rid of the frame for weblinks add this to the additional options
1145 in the document settings under
1148 \begin_inset space ~
1156 \begin_layout Standard
1159 urlbordercolor={1 0 0}
1162 \begin_layout Standard
1163 if your push button border color is red (the default), otherwise use the
1164 same color definition as for your push button border color.
1167 \begin_layout Subsection
1169 \begin_inset CommandInset label
1171 name "sub:Submit-button"
1178 \begin_layout Standard
1179 A submit button is used to submit the form data to a server.
1180 It is added by inserting the custom inset
1185 Write inside the inset the label for the button.
1189 \begin_layout Standard
1190 \begin_inset Flex SubmitButton
1193 \begin_layout Plain Layout
1194 \begin_inset Argument 1
1197 \begin_layout Plain Layout
1203 Send your data via email
1211 \begin_layout Standard
1212 The submit button creates a forms data format (FDF) file (file extension
1213 *.fdf) which is then submitted.
1214 The FDF file contains only the form data.
1215 They can only be applied to a PDF form if all fields in the form have a
1219 \begin_layout Standard
1220 \begin_inset Note Greyedout
1223 \begin_layout Plain Layout
1228 You can only use a submit button if you specified the submit method and
1229 target in the PDF form environment options! See sec.
1230 \begin_inset space \thinspace{}
1234 \begin_inset CommandInset ref
1236 reference "sec:Preparation"
1240 for the description.
1241 If there are no specifications you will get LaTeX errors!
1249 \begin_layout Standard
1250 \begin_inset Note Greyedout
1253 \begin_layout Plain Layout
1258 If you have more than one submit button in your document you must specify
1259 a name for each of them to avoid LaTeX errors! For example add
1267 is the button name).
1275 \begin_layout Subsection
1279 \begin_layout Standard
1280 A reset button is used to reset all form fields to the initial state.
1281 It is added by inserting the custom inset
1286 Write inside the inset the label for the button.
1290 \begin_layout Standard
1291 \begin_inset Flex ResetButton
1294 \begin_layout Plain Layout
1295 \begin_inset Argument 1
1298 \begin_layout Plain Layout
1312 \begin_layout Standard
1313 \begin_inset Note Greyedout
1316 \begin_layout Plain Layout
1321 If you have more than one reset button in your document you must specify
1322 a name for each of them to avoid LaTeX errors! For example add
1330 is the button name).
1338 \begin_layout Section
1339 Form field customization
1340 \begin_inset CommandInset label
1342 name "sec:Form-field-customization"
1349 \begin_layout Standard
1350 Since all form elements should look uniform, one can determine their layout
1351 using the following styles:
1354 \begin_layout Description
1356 \begin_inset space ~
1360 \begin_inset space ~
1366 \begin_layout Description
1368 \begin_inset space ~
1372 \begin_inset space ~
1378 \begin_layout Description
1380 \begin_inset space ~
1384 \begin_inset space ~
1387 Style affects all choice menu types
1390 \begin_layout Description
1392 \begin_inset space ~
1396 \begin_inset space ~
1399 Style affects only the combo box style
1402 \begin_layout Description
1404 \begin_inset space ~
1408 \begin_inset space ~
1411 Style affects only the popdown box style
1414 \begin_layout Description
1416 \begin_inset space ~
1420 \begin_inset space ~
1423 Style affects only the radio box style
1426 \begin_layout Description
1428 \begin_inset space ~
1432 \begin_inset space ~
1438 \begin_layout Description
1440 \begin_inset space ~
1444 \begin_inset space ~
1450 \begin_layout Description
1452 \begin_inset space ~
1456 \begin_inset space ~
1462 \begin_layout Text Field Style
1466 \begin_layout Standard
1467 The content of the styles is a comma-separated list of parameters.
1468 The possible parameters are listed in sec.
1469 \begin_inset space \thinspace{}
1473 \begin_inset Quotes eld
1476 Forms optional parameters
1477 \begin_inset Quotes erd
1480 of the documentation of the LaTeX package
1485 \begin_inset CommandInset citation
1492 It is important that the parameter print is always part of the definition,
1493 otherwise the fields won't appear in the PDF output.
1494 The defined style is applied to all fields following the definition.
1497 \begin_layout Subsubsection*
1498 Here are some examples:
1501 \begin_layout Text Field Style
1502 print, bordercolor=red, borderstyle=U, backgroundcolor=lightgray, color=lime,
1503 maxlen=10, align=2, charsize=16pt
1506 \begin_layout Check Box Style
1507 print, borderstyle=S, checkboxsymbol=
1512 \begin_layout Combo Box Style
1513 print, bordercolor={0.33 0.66 0.33}, borderstyle=D
1516 \begin_layout Popdown Box Style
1520 \begin_layout Radio Box Style
1521 print, borderstyle=I, radiosymbol=6
1524 \begin_layout Push Button Style
1525 print, borderstyle=B, bordercolor=lime
1528 \begin_layout Submit Button Style
1529 print, borderwidth=0, bordercolor=white
1532 \begin_layout Reset Button Style
1533 print, bordercolor=lime
1536 \begin_layout Itemize
1537 Text field with gray background, lime text color, a red border only below
1538 the field, right alignment, 16
1539 \begin_inset space \thinspace{}
1542 pt font size and a limitation for maximal 10
1543 \begin_inset space ~
1546 characters to insert:
1547 \begin_inset VSpace defskip
1551 \begin_inset Newline newline
1555 \begin_inset Flex TextField
1558 \begin_layout Plain Layout
1559 \begin_inset Argument 1
1562 \begin_layout Plain Layout
1568 Enter your name here:
1576 \begin_layout Standard
1604 \begin_layout Standard
1605 \begin_inset Note Greyedout
1608 \begin_layout Plain Layout
1617 has only an effect for text fields if a
1629 \begin_layout Itemize
1630 Check box with normal border and symbol
1633 \begin_inset VSpace defskip
1637 \begin_inset Newline newline
1641 \begin_inset Flex CheckBox
1644 \begin_layout Plain Layout
1645 \begin_inset Argument 1
1648 \begin_layout Plain Layout
1654 Are you older than 18 years?
1662 \begin_layout Standard
1663 The symbol is either specified as number or with the command
1664 \begin_inset Newline newline
1674 \begin_inset Newline newline
1681 is one of the possible numbers listed in Table
1682 \begin_inset space ~
1686 \begin_inset CommandInset citation
1695 \begin_layout Itemize
1696 Combo box with dashed, colored border:
1697 \begin_inset VSpace defskip
1701 \begin_inset Newline newline
1705 \begin_inset Flex ChoiceMenu
1708 \begin_layout Plain Layout
1709 \begin_inset Argument 1
1712 \begin_layout Plain Layout
1713 combo, name=combo2, default=Az
1718 Albania=Al, Armenia=Ar, Azerbaidschan=Az
1719 \begin_inset Argument 2
1722 \begin_layout Plain Layout
1736 \begin_layout Itemize
1737 Popdown box where only 2
1738 \begin_inset space ~
1741 entries are shown and where the last entry is preselected:
1742 \begin_inset VSpace defskip
1746 \begin_inset Newline newline
1750 \begin_inset Flex ChoiceMenu
1753 \begin_layout Plain Layout
1754 \begin_inset Argument 1
1757 \begin_layout Plain Layout
1758 popdown, name=country2, value=Az
1763 Albania=Al, Armenia=Ar, Azerbaidschan=Az
1764 \begin_inset Argument 2
1767 \begin_layout Plain Layout
1781 \begin_layout Standard
1782 \begin_inset VSpace defskip
1786 \begin_inset Note Greyedout
1789 \begin_layout Plain Layout
1806 has no effect for popdown boxes.
1814 \begin_layout Itemize
1815 Radio box with inverted bevel border and symbol number
1816 \begin_inset space ~
1820 \begin_inset VSpace defskip
1824 \begin_inset Newline newline
1828 \begin_inset Flex ChoiceMenu
1831 \begin_layout Plain Layout
1832 \begin_inset Argument 1
1835 \begin_layout Plain Layout
1842 \begin_inset Argument 2
1845 \begin_layout Plain Layout
1859 \begin_layout Itemize
1860 Push button with a bevel border and colored text:
1861 \begin_inset VSpace defskip
1865 \begin_inset Newline newline
1869 \begin_inset Flex PushButton
1872 \begin_layout Plain Layout
1873 \begin_inset Argument 1
1876 \begin_layout Plain Layout
1881 \begin_layout Plain Layout
1892 \begin_layout Plain Layout
1899 Why do you click this?
1903 \begin_layout Plain Layout
1914 \begin_layout Plain Layout
1930 \begin_layout Plain Layout
1941 Don't click on this button!!!
1947 \begin_layout Plain Layout
1962 \begin_layout Standard
1963 \begin_inset VSpace defskip
1967 \begin_inset Note Greyedout
1970 \begin_layout Plain Layout
1983 has no effect for push, submit and reset buttons.
1991 \begin_layout Standard
1992 As workaround use the command
1998 as described in sec.
1999 \begin_inset space \thinspace{}
2003 \begin_inset Quotes eld
2007 \begin_inset Quotes erd
2015 \begin_inset Newline newline
2018 In the button above this code was used:
2019 \begin_inset Newline newline
2026 colorbox{lime}{Don't click on this button!!!}
2029 \begin_inset Newline newline
2032 and the button text was colored.
2035 \begin_layout Standard
2036 \begin_inset Note Greyedout
2039 \begin_layout Plain Layout
2052 has no effect for push, submit and reset buttons.
2060 \begin_layout Standard
2061 As workaround use the box method described in sec.
2062 \begin_inset space \thinspace{}
2066 \begin_inset CommandInset ref
2068 reference "sub:Action-button-customization"
2075 \begin_layout Itemize
2076 Submit button without border, with cyan background color and increased height:
2077 \begin_inset VSpace defskip
2081 \begin_inset Newline newline
2085 \begin_inset Flex SubmitButton
2088 \begin_layout Plain Layout
2089 \begin_inset Argument 1
2092 \begin_layout Plain Layout
2102 \begin_layout Plain Layout
2112 \begin_inset Box Frameless
2122 height_special "totalheight"
2125 \begin_layout Plain Layout
2129 \begin_layout Plain Layout
2138 Send your data via mail
2147 \begin_layout Plain Layout
2160 \begin_inset VSpace bigskip
2166 \begin_layout Itemize
2167 Reset button with a width of 7
2168 \begin_inset space \thinspace{}
2172 \begin_inset VSpace defskip
2176 \begin_inset Newline newline
2180 \begin_inset Flex ResetButton
2183 \begin_layout Plain Layout
2184 \begin_inset Argument 1
2187 \begin_layout Plain Layout
2194 \begin_inset Box Frameless
2204 height_special "totalheight"
2207 \begin_layout Plain Layout
2211 \begin_layout Plain Layout
2233 \begin_layout Section
2234 PDF viewer action buttons
2237 \begin_layout Standard
2238 One often needs basic actions to be done by the PDF viewer program.
2239 For example to print the form.
2240 Such PDF program-specific actions can be triggered by adding inserting
2246 The PDF viewer programs
2254 can handle all possible actions while other PDF viewers might only support
2256 However, all PDF viewer programs support the basic things like printing,
2258 \begin_inset space ~
2261 as, view in fullscreen etc..
2264 \begin_layout Standard
2265 To specify the action insert its name to the
2270 A list with possible actions can be found in sec.
2271 \begin_inset space \thinspace{}
2275 \begin_inset Quotes eld
2278 Acrobat-specific behavior
2279 \begin_inset Quotes erd
2282 of the documentation of the LaTeX package
2287 \begin_inset CommandInset citation
2296 \begin_layout Standard
2297 Here are some examples:
2300 \begin_layout Description
2302 \begin_inset Flex PDFAction
2305 \begin_layout Plain Layout
2306 \begin_inset Argument 1
2309 \begin_layout Plain Layout
2323 \begin_layout Description
2325 \begin_inset space ~
2329 \begin_inset Flex PDFAction
2332 \begin_layout Plain Layout
2333 \begin_inset Argument 1
2336 \begin_layout Plain Layout
2350 \begin_layout Description
2352 \begin_inset space ~
2356 \begin_inset space ~
2360 \begin_inset Flex PDFAction
2363 \begin_layout Plain Layout
2364 \begin_inset Argument 1
2367 \begin_layout Plain Layout
2373 View the form in fullscreen
2381 \begin_layout Subsection
2382 Action button customization
2383 \begin_inset CommandInset label
2385 name "sub:Action-button-customization"
2392 \begin_layout Standard
2393 Customizing the action buttons requires the usage of boxes because things
2394 like the width, height and border separation cannot be specified as button
2398 \begin_layout Standard
2399 The easiest way to customize the buttons is to fill it with a custom box.
2400 For example the button should be 4
2401 \begin_inset space \thinspace{}
2404 cm wide and have the height of 2 lines.
2405 Then create this parbox:
2408 \begin_layout Standard
2409 \begin_inset Box Frameless
2419 height_special "totalheight"
2422 \begin_layout Plain Layout
2432 \begin_layout Standard
2438 To center the text in the button add
2444 as TeX code right before the button text.
2448 \begin_layout Standard
2449 \begin_inset Flex PDFAction
2452 \begin_layout Plain Layout
2453 \begin_inset Argument 1
2456 \begin_layout Plain Layout
2463 \begin_inset Box Frameless
2473 height_special "totalheight"
2476 \begin_layout Plain Layout
2480 \begin_layout Plain Layout
2502 \begin_layout Standard
2503 To customize the border color, add the command
2505 menubordercolor={r g b}
2507 to the additional options in the document settings under
2510 \begin_inset space ~
2527 with a number between 0 and 1 for the colors red, green and blue.
2528 If you want to change the border color only for certain buttons, use the
2532 \begin_inset space ~
2536 \begin_inset space ~
2541 before the button and insert there the command
2546 The default value of
2557 \begin_layout PDF Link Setup
2558 menubordercolor={0.1 0.9 0.5}
2561 \begin_layout Standard
2564 menubordercolor={0.1 0.9 0.5}
2567 \begin_inset Newline newline
2571 \begin_inset Flex PDFAction
2574 \begin_layout Plain Layout
2575 \begin_inset Argument 1
2578 \begin_layout Plain Layout
2585 \begin_inset Box Frameless
2595 height_special "totalheight"
2598 \begin_layout Plain Layout
2603 \begin_layout Plain Layout
2625 \begin_layout Standard
2626 To change the border width use the command
2634 is the width in pixels.
2635 The default value of
2646 \begin_layout Standard
2647 \begin_inset Note Greyedout
2650 \begin_layout Plain Layout
2659 affects all link types, not only the menu links.
2667 \begin_layout PDF Link Setup
2668 pdfborder={0 0 4}, menubordercolor={1 1 0}
2671 \begin_layout Standard
2673 \begin_inset space ~
2676 pixel thick yellow border:
2677 \begin_inset Newline newline
2681 \begin_inset Flex PDFAction
2684 \begin_layout Plain Layout
2685 \begin_inset Argument 1
2688 \begin_layout Plain Layout
2695 \begin_inset Box Frameless
2705 height_special "totalheight"
2708 \begin_layout Plain Layout
2713 \begin_layout Plain Layout
2735 \begin_layout Standard
2736 To change the background color insert the command
2742 at the beginning of the button inset and a
2751 is hereby the name of the color as described in sec.
2752 \begin_inset space \thinspace{}
2756 \begin_inset Quotes eld
2760 \begin_inset Quotes erd
2770 \begin_layout PDF Link Setup
2774 \begin_layout Standard
2775 An example without a border and with lime background color:
2776 \begin_inset Newline newline
2780 \begin_inset Flex PDFAction
2783 \begin_layout Plain Layout
2784 \begin_inset Argument 1
2787 \begin_layout Plain Layout
2797 \begin_layout Plain Layout
2807 \begin_inset Box Frameless
2817 height_special "totalheight"
2820 \begin_layout Plain Layout
2825 \begin_layout Plain Layout
2843 \begin_layout Plain Layout
2858 \begin_layout PDF Link Setup
2859 pdfborder={0 0 1}, menubordercolor={1 0 0}
2862 \begin_layout Section
2866 \begin_layout Standard
2867 It is also possible to have dynamic form fields.
2868 This means that depending on the actions of the user fields can (dis)appear
2869 or change their appearance.
2870 To use this feature, add these lines to your document preamble:
2873 \begin_layout Standard
2878 usepackage[pdftex]{insdljs}
2879 \begin_inset Newline newline
2893 \begin_layout Standard
2894 Then add the necessary JavaScript code to your document LaTeX preamble or
2895 as TeX code to your document.
2896 For info about JavaScript, see its documentation,
2897 \begin_inset CommandInset citation
2906 \begin_layout Standard
2910 \begin_layout Plain Layout
2920 \begin_inset Note Note
2923 \begin_layout Plain Layout
2924 The following section will only be displayed when the LaTeX package
2936 \begin_layout Standard
2937 For the following choice menu this JavaScript code was used:
2940 \begin_layout Standard
2941 \begin_inset listings
2942 lstparams "language=TeX"
2946 \begin_layout Plain Layout
2950 begin{insDLJS}[exaaae]{exaaae}{JavaScript}
2953 \begin_layout Plain Layout
2955 function validateTime(){
2958 \begin_layout Plain Layout
2963 \begin_layout Plain Layout
2965 if((event.value == "u") || (event.value == "unlimited")) {
2968 \begin_layout Plain Layout
2970 this.getField("from").display = display.hidden;
2973 \begin_layout Plain Layout
2975 this.getField("to").display = display.hidden;
2978 \begin_layout Plain Layout
2983 \begin_layout Plain Layout
2985 this.getField("from").display = display.visible;
2988 \begin_layout Plain Layout
2990 this.getField("to").display = display.visible;
2993 \begin_layout Plain Layout
2995 this.getField("from").setFocus();
2998 \begin_layout Plain Layout
3003 \begin_layout Plain Layout
3008 \begin_layout Plain Layout
3013 \begin_layout Plain Layout
3025 \begin_layout Standard
3026 \begin_inset Note Greyedout
3029 \begin_layout Plain Layout
3038 JavaScript funtions must be inserted into the same
3050 \begin_layout Standard
3054 \begin_inset space ~
3058 \begin_inset space ~
3063 of the following choice menu are
3064 \begin_inset Newline newline
3069 name=contract,radio,default=tl,validate={validateTime();}
3072 \begin_layout Standard
3073 \begin_inset Flex ChoiceMenu
3076 \begin_layout Plain Layout
3077 \begin_inset Argument 1
3080 \begin_layout Plain Layout
3081 name=contract,radio,default=tl,validate=
3085 \begin_layout Plain Layout
3096 \begin_layout Plain Layout
3108 term-limited=tl, unlimited=u
3109 \begin_inset Argument 2
3112 \begin_layout Plain Layout
3124 \begin_inset VSpace defskip
3130 \begin_layout Standard
3131 \begin_inset Tabular
3132 <lyxtabular version="3" rows="3" columns="2">
3133 <features rotate="0" tabularvalignment="middle">
3134 <column alignment="left" valignment="top">
3135 <column alignment="center" valignment="top">
3137 <cell alignment="left" valignment="top" usebox="none">
3140 \begin_layout Plain Layout
3146 <cell alignment="center" valignment="top" usebox="none">
3149 \begin_layout Plain Layout
3150 \begin_inset Flex TextField
3153 \begin_layout Plain Layout
3154 \begin_inset Argument 1
3157 \begin_layout Plain Layout
3158 name=from,width=10em
3175 <cell alignment="center" valignment="top" usebox="none">
3178 \begin_layout Plain Layout
3184 <cell alignment="center" valignment="top" usebox="none">
3187 \begin_layout Plain Layout
3188 \begin_inset VSpace -1.5mm
3198 <cell alignment="left" valignment="top" usebox="none">
3201 \begin_layout Plain Layout
3207 <cell alignment="center" valignment="top" usebox="none">
3210 \begin_layout Plain Layout
3211 \begin_inset Flex TextField
3214 \begin_layout Plain Layout
3215 \begin_inset Argument 1
3218 \begin_layout Plain Layout
3242 \begin_layout Standard
3243 \begin_inset VSpace bigskip
3249 \begin_layout Standard
3250 To check and assure that the user only enters a number to a text field you
3251 can for example use this JavaScript code:
3254 \begin_layout Standard
3255 \begin_inset listings
3256 lstparams "language=TeX"
3260 \begin_layout Plain Layout
3262 function checkNumber() {
3265 \begin_layout Plain Layout
3270 \begin_layout Plain Layout
3272 if (!Number(event.value)) {
3275 \begin_layout Plain Layout
3277 app.alert("Value must be a number!");
3280 \begin_layout Plain Layout
3285 \begin_layout Plain Layout
3290 \begin_layout Plain Layout
3292 event.target.textColor = color.green;
3295 \begin_layout Plain Layout
3305 \begin_layout Standard
3306 An example text field:
3307 \begin_inset Flex TextField
3310 \begin_layout Plain Layout
3311 \begin_inset Argument 1
3314 \begin_layout Plain Layout
3315 name=onlyNumbers, align=1, validate=
3319 \begin_layout Plain Layout
3330 \begin_layout Plain Layout
3350 \begin_layout Standard
3354 \begin_layout Plain Layout
3364 \begin_inset Note Note
3367 \begin_layout Plain Layout
3368 The following will be displayed when the LaTeX package
3380 \begin_layout Standard
3381 You need to install the package
3385 to see the content of this section in the output.
3388 \begin_layout Standard
3392 \begin_layout Plain Layout
3404 \begin_layout End PDF Form
3405 \begin_inset Note Note
3408 \begin_layout Plain Layout
3417 \begin_layout Section
3418 General notes and hints
3421 \begin_layout Itemize
3422 Submitting and applying data requires that all form fields have a name.
3425 \begin_layout Itemize
3426 All braces, brackets, backslashes and quote characters in form parameters
3427 must be inserted as TeX code!
3430 \begin_layout Itemize
3431 It is not possible to create a PDF form using XeTeX.
3432 Use either the LyX export formats
3443 \begin_layout Itemize
3444 To be able to use all kinds of colors and color definitions you must load
3449 in the document preamble this way:
3450 \begin_inset Newline newline
3457 usepackage[svgnames,rgb]{xcolor}
3460 \begin_layout Itemize
3469 custom background colors you must disable in these programs to highlight
3470 the available form fields in the PDF.
3473 \begin_layout Bibliography
3474 \begin_inset CommandInset bibitem
3475 LatexCommand bibitem
3481 \begin_inset CommandInset href
3483 name "JavaScript reference"
3484 target "https://developer.mozilla.org/en/docs/Web/JavaScript/Reference"
3491 \begin_layout Bibliography
3492 \begin_inset CommandInset bibitem
3493 LatexCommand bibitem
3499 \begin_inset CommandInset href
3501 name "Documentation"
3502 target "http://mirrors.ctan.org/macros/latex/contrib/hyperref/doc/manual.pdf"
3506 of the LaTeX package
3511 \begin_layout Bibliography
3512 \begin_inset CommandInset bibitem
3513 LatexCommand bibitem
3519 \begin_inset CommandInset href
3521 name "Documentation"
3522 target "http://mirrors.ctan.org/macros/latex/required/psnfss/psnfss2e.pdf"
3526 of the LaTeX package