1 #LyX 2.3 created this file. For more info see http://www.lyx.org/
5 \save_transient_properties true
6 \origin /systemlyxdir/examples/Modules/
9 % used to check for needed LaTeX packages
12 % check for package insdljs
13 % used for JavScript code
15 \IfFileExists{insdljs.sty}
16 {\usepackage[pdftex]{insdljs}
17 \setboolean{insdljs}{true}
18 \pdfcatalog{/AA \the\pdflastobj\space 0 R}}
19 {\setboolean{insdljs}{false}}
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("until").display = display.hidden;
31 this.getField("from").display = display.visible;
32 this.getField("until").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 \use_dash_ligatures false
87 \default_output_format pdf2
89 \bibtex_command bibtex
90 \index_command default
94 \pdf_title "Description of the module pdfcomment"
95 \pdf_author "Uwe Stöhr"
96 \pdf_subject "PDF form"
97 \pdf_keywords "LyX, PDF forms, hyperref"
99 \pdf_bookmarksnumbered true
100 \pdf_bookmarksopen true
101 \pdf_bookmarksopenlevel 2
102 \pdf_breaklinks false
104 \pdf_colorlinks false
106 \pdf_pdfusetitle false
107 \pdf_quoted_options "pdfpagelayout=OneColumn, pdfnewwindow=true, pdfstartview=XYZ, plainpages=false, urlbordercolor={1 0 0}"
110 \use_package amsmath 1
111 \use_package amssymb 1
112 \use_package cancel 1
114 \use_package mathdots 1
115 \use_package mathtools 1
116 \use_package mhchem 1
117 \use_package stackrel 1
118 \use_package stmaryrd 1
119 \use_package undertilde 1
121 \cite_engine_type default
125 \paperorientation portrait
130 \notefontcolor #0000ff
137 \paragraph_separation skip
140 \math_numbering_side default
141 \quotes_style english
145 \paperpagestyle default
146 \tracking_changes false
147 \output_changes false
150 \html_be_strict false
155 \begin_layout Begin PDF Form
156 \begin_inset Argument 1
159 \begin_layout Plain Layout
161 action=mailto:forms@lyx.test?subject=The submitted PDF form, method=post
170 Description of the module PDF Form
177 \begin_layout Standard
178 \begin_inset Note Note
181 \begin_layout Plain Layout
182 To export all parts of this document to PDF the \SpecialChar LaTeX
188 If it is not installed you can export the document anyway but the example
189 in the section about dynamic form elements will not appear in the output.
197 \begin_layout Standard
198 By loading the module PDF
202 Form the whole document or a part of it can be made a PDF form.
203 You can add all possible form elements like text fields buttons etc.
204 This document describes how this is done.
207 \begin_layout Section
209 \begin_inset CommandInset label
211 name "sec:Preparation"
218 \begin_layout Standard
219 At first load the module PDF
223 Form in the document settings of your file.
224 To make the whole document a form, insert the environment
236 from \SpecialChar LyX
237 's dropdown menu at the beginning of the document.
238 If only a part of the document should be a form, add
250 at the position where the form should start.
253 \begin_layout Standard
254 \begin_inset Note Greyedout
257 \begin_layout Plain Layout
262 It is only possible to have one form in a PDF file!
270 \begin_layout Standard
271 If the form data should be submitted to a server or the like, then you must
272 specify the URL as parameter of the
285 This is done by using the menu
287 Insert\SpecialChar menuseparator
299 For example in this document the following was inserted to the parameter
303 \begin_layout Standard
306 action=mailto:forms@lyx.test?subject=The submitted PDF form,
307 \begin_inset Newline newline
313 \begin_layout Standard
314 This sends the form data as email to
318 when the user presses the submit button.
319 The email subject will be
320 \begin_inset Quotes eld
323 The submitted PDF form
324 \begin_inset Quotes erd
327 and the submit method is
332 (The other possible method would be
336 .) For more about submitting see sec.
337 \begin_inset space \thinspace{}
341 \begin_inset CommandInset ref
343 reference "subsec:Submit-button"
350 \begin_layout Standard
351 \begin_inset Newpage newpage
357 \begin_layout Section
361 \begin_layout Standard
366 possible elements in a PDF form:
369 \begin_layout Subsection
373 \begin_layout Standard
374 A text field is added by inserting the custom inset
380 Insert\SpecialChar menuseparator
388 Write inside the inset the label for the text field that will be printed
389 in the PDF output before the field.
391 \begin_inset Newline newline
395 \begin_inset Flex TextField
398 \begin_layout Plain Layout
399 \begin_inset Argument 1
402 \begin_layout Plain Layout
408 Enter your name here:
416 \begin_layout Standard
417 You must also specify a name for text fields.
418 To do this set the cursor into its
422 inset and insert the parameter
433 \begin_layout Standard
434 Using the same name for several text fields results in an automatic duplication
435 of the inserted text.
436 This is for example useful if the user should input a date that should
437 appear at different places in the form.
438 \begin_inset Newline newline
445 fields as example: Fill one and see that the other one will be filled automatica
446 lly when you click outside of the field:
447 \begin_inset Newline newline
451 \begin_inset Flex TextField
454 \begin_layout Plain Layout
455 \begin_inset Argument 1
458 \begin_layout Plain Layout
470 \begin_inset Newline newline
474 \begin_inset Flex TextField
477 \begin_layout Plain Layout
478 \begin_inset Argument 1
481 \begin_layout Plain Layout
495 \begin_layout Standard
496 \begin_inset Note Greyedout
499 \begin_layout Plain Layout
504 Special characters should be avoided in element names.
512 \begin_layout Standard
513 All form fields can be customized by adding parameters.
516 \begin_layout Standard
517 Here is a customized multiline text field with a width of 60
518 \begin_inset space \thinspace{}
521 % of the text width, 3
522 \begin_inset space \thinspace{}
525 cm height and a proposed content:
526 \begin_inset VSpace defskip
530 \begin_inset Newline newline
534 \begin_inset Flex TextField
537 \begin_layout Plain Layout
538 \begin_inset Argument 1
541 \begin_layout Plain Layout
542 name=customer2, multiline, width=0.6
544 textwidth, height=3cm, value={proposed text}
549 Enter your name here:
557 \begin_layout Standard
558 \begin_inset Note Greyedout
561 \begin_layout Plain Layout
566 It is highly recommended to use a uniform layout of all fields in a form.
568 \begin_inset space \thinspace{}
572 \begin_inset CommandInset ref
574 reference "sec:Form-element-customization"
586 \begin_layout Subsection
590 \begin_layout Standard
591 A check box is added by inserting the custom inset
596 Write inside the inset the label for the box.
598 \begin_inset Newline newline
602 \begin_inset Flex CheckBox
605 \begin_layout Plain Layout
606 \begin_inset Argument 1
609 \begin_layout Plain Layout
615 Are you older than 18 years?
623 \begin_layout Standard
624 You must specify also for check boxes a name.
626 \begin_inset space \thinspace{}
630 \begin_inset space \space{}
641 is the name) into the
648 \begin_layout Subsection
652 \begin_layout Standard
653 A choice menu is added by inserting the custom inset
658 A label for the inset is added by using the menu
660 Insert\SpecialChar menuseparator
664 The different choices are inserted to the inset as comma-separated list.
672 \begin_layout Description
673 Radio Only one choice can be selected
676 \begin_layout Description
677 Combo The choices are listed in a combo box (dropdown list) but the user
678 is allowed to input something that is not in the predefined list.
681 \begin_layout Description
682 Popdown All choices are listed below each other.
683 If the menu is not high enough a scroll bar is automatically added.
686 \begin_layout Standard
687 To determine the choice menu type one uses the parameter
702 \begin_layout Standard
703 Here is an example for the radio type:
704 \begin_inset VSpace defskip
708 \begin_inset Newline newline
712 \begin_inset Flex ChoiceMenu
715 \begin_layout Plain Layout
716 \begin_inset Argument 1
719 \begin_layout Plain Layout
726 \begin_inset Argument 2
729 \begin_layout Plain Layout
743 \begin_layout Standard
744 Here is an example for the combo type:
745 \begin_inset VSpace defskip
749 \begin_inset Newline newline
753 \begin_inset Flex ChoiceMenu
756 \begin_layout Plain Layout
757 \begin_inset Argument 1
760 \begin_layout Plain Layout
766 Albania=Al, Armenia=Ar, Azerbaidschan=Az
767 \begin_inset Argument 2
770 \begin_layout Plain Layout
784 \begin_layout Standard
785 Here is an example for the popdown type:
786 \begin_inset VSpace defskip
790 \begin_inset Newline newline
794 \begin_inset Flex ChoiceMenu
797 \begin_layout Plain Layout
798 \begin_inset Argument 1
801 \begin_layout Plain Layout
802 popdown, name=country
807 Albania=Al, Armenia=Ar, Azerbaidschan=Az
808 \begin_inset Argument 2
811 \begin_layout Plain Layout
825 \begin_layout Standard
826 You must also specify a name for choice menus.
827 Insert for example the parameter
835 is the name) into the
842 \begin_layout Standard
843 It is recommended to add a short name for every choice to be able to access
844 them and to know which one was chosen by the user.
845 This is done by adding
849 behind each choice (where
854 For example the radio type example contains this choice list:
860 \begin_inset Quotes eld
864 \begin_inset Quotes erd
867 you know that he chose the choice
868 \begin_inset Quotes eld
872 \begin_inset Quotes erd
876 With the name you can also preset/propose e.g.
877 \begin_inset space \space{}
881 \begin_inset Quotes eld
885 \begin_inset Quotes erd
888 by adding the parameter
896 \begin_layout Standard
897 \begin_inset Flex ChoiceMenu
900 \begin_layout Plain Layout
901 \begin_inset Argument 1
904 \begin_layout Plain Layout
905 radio, name=sex, default=m
911 \begin_inset Argument 2
914 \begin_layout Plain Layout
928 \begin_layout Subsection
932 \begin_layout Standard
933 A push button is added by inserting the custom inset
938 Write inside the inset the label for the button.
942 \begin_layout Standard
943 \begin_inset Flex PushButton
946 \begin_layout Plain Layout
947 \begin_inset Argument 1
950 \begin_layout Plain Layout
956 Don't click on this button or your fridge will be destroyed!!!
964 \begin_layout Standard
965 The action that is triggered by pressing the button is specified by JavaScript
967 To do this, add the parameter
971 and insert the JavaScript code between the braces.
972 For info about JavaScript, see its documentation,
973 \begin_inset CommandInset citation
981 In the following example this JavaScript code was used:
982 \begin_inset Newline newline
991 \begin_layout Plain Layout
998 What the hell? Now you destroyed your fridge.
1000 \begin_inset Quotes eld
1004 \begin_inset Quotes erd
1011 \begin_layout Plain Layout
1021 \begin_layout Standard
1022 \begin_inset Flex PushButton
1025 \begin_layout Plain Layout
1026 \begin_inset Argument 1
1029 \begin_layout Plain Layout
1034 \begin_layout Plain Layout
1041 What the hell? Now you destroyed your fridge.
1043 \begin_inset Quotes eld
1047 \begin_inset Quotes erd
1054 \begin_layout Plain Layout
1066 Don't click on this button or your fridge will be destroyed!!!
1074 \begin_layout Standard
1075 \begin_inset Note Greyedout
1078 \begin_layout Plain Layout
1083 The outer quotes are part of the JavaScript code and must therefore be
1084 inserted as \SpecialChar TeX
1093 \begin_layout Standard
1094 A common usage for push buttons is to open a weblink.
1095 Such a button is created by inserting a hyperlink as button text.
1099 \begin_layout Standard
1100 \begin_inset Flex PushButton
1103 \begin_layout Plain Layout
1104 \begin_inset Argument 1
1107 \begin_layout Plain Layout
1114 \begin_inset CommandInset href
1116 name "Information how to fill out this form"
1117 target "https://wiki.lyx.org"
1130 \begin_layout Standard
1131 To get rid of the predefined frame for weblinks add this to the additional
1132 options in the document settings under
1135 \begin_inset space ~
1143 \begin_layout Standard
1146 urlbordercolor={1 0 0}
1149 \begin_layout Standard
1150 if your push button border color is red (the default), otherwise use the
1151 same color definition as for your push button border color.
1154 \begin_layout Subsection
1156 \begin_inset CommandInset label
1158 name "subsec:Submit-button"
1165 \begin_layout Standard
1166 A submit button is used to submit the form data to a server.
1167 It is added by inserting the custom inset
1172 The label for the button is written into the inset.
1176 \begin_layout Standard
1177 \begin_inset Flex SubmitButton
1180 \begin_layout Plain Layout
1181 \begin_inset Argument 1
1184 \begin_layout Plain Layout
1190 Send your data via email
1198 \begin_layout Standard
1199 The submit button creates a forms data format (FDF) file (file extension
1200 *.fdf) which is then submitted.
1201 The FDF file contains only the form data.
1202 They can later only be applied to a PDF form if all elements in the form
1206 \begin_layout Standard
1207 \begin_inset Note Greyedout
1210 \begin_layout Plain Layout
1215 You can only use a submit button if you specified the submit method and
1216 a target in the inset
1219 \begin_inset space ~
1223 \begin_inset space ~
1229 \begin_inset space \thinspace{}
1233 \begin_inset CommandInset ref
1235 reference "sec:Preparation"
1239 for the description.
1240 If there are no specifications you will get \SpecialChar LaTeX
1249 \begin_layout Subsection
1253 \begin_layout Standard
1254 A reset button is used to reset all form elements to the initial state.
1255 It is added by inserting the custom inset
1260 The label for the button is written into the inset.
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 Section
1287 Form element customization
1288 \begin_inset CommandInset label
1290 name "sec:Form-element-customization"
1297 \begin_layout Standard
1298 Since all form elements should look uniform, one can determine their layout
1299 using the following styles:
1302 \begin_layout Description
1304 \begin_inset space ~
1308 \begin_inset space ~
1314 \begin_layout Description
1316 \begin_inset space ~
1320 \begin_inset space ~
1326 \begin_layout Description
1328 \begin_inset space ~
1332 \begin_inset space ~
1335 Style affects all choice menu types
1338 \begin_layout Description
1340 \begin_inset space ~
1344 \begin_inset space ~
1347 Style affects only the combo box style
1350 \begin_layout Description
1352 \begin_inset space ~
1356 \begin_inset space ~
1359 Style affects only the popdown box style
1362 \begin_layout Description
1364 \begin_inset space ~
1368 \begin_inset space ~
1371 Style affects only the radio box style
1374 \begin_layout Description
1376 \begin_inset space ~
1380 \begin_inset space ~
1386 \begin_layout Description
1388 \begin_inset space ~
1392 \begin_inset space ~
1398 \begin_layout Description
1400 \begin_inset space ~
1404 \begin_inset space ~
1410 \begin_layout Standard
1411 The content of the styles is a comma-separated list of parameters.
1412 The possible parameters are listed in sec.
1413 \begin_inset space \thinspace{}
1417 \begin_inset Quotes eld
1420 Forms optional parameters
1421 \begin_inset Quotes erd
1424 of the documentation of the \SpecialChar LaTeX
1430 \begin_inset CommandInset citation
1438 It is important that the parameter
1442 is always part of the definition.
1443 Otherwise the elements will not appear in the PDF.
1444 The defined style is applied to all elements following the definition.
1447 \begin_layout Subsubsection*
1448 Here are some examples:
1451 \begin_layout Text Field Style
1452 print, bordercolor=red, borderstyle=U, backgroundcolor=lightgray, color=lime,
1453 maxlen=10, align=2, charsize=16pt
1454 \begin_inset Note Note
1457 \begin_layout Plain Layout
1490 \begin_layout Check Box Style
1491 print, borderstyle=S, checkboxsymbol=
1496 \begin_layout Combo Box Style
1497 print, bordercolor={0.33 0.66 0.33}, borderstyle=D
1500 \begin_layout Popdown Box Style
1502 \begin_inset Note Note
1505 \begin_layout Plain Layout
1510 determines the number of displayed menu entries.
1511 It does not work currently because of a bug in the \SpecialChar LaTeX
1524 \begin_layout Radio Box Style
1525 print, borderstyle=I, radiosymbol=3
1528 \begin_layout Push Button Style
1529 print, borderstyle=B, bordercolor=lime
1532 \begin_layout Submit Button Style
1533 print, borderwidth=0, bordercolor=white
1536 \begin_layout Reset Button Style
1537 print, bordercolor=lime
1540 \begin_layout Itemize
1541 Text field with gray background, lime text color, a red border only below
1542 the field, right alignment, 16
1543 \begin_inset space \thinspace{}
1546 pt font size and a limitation for maximal 10
1547 \begin_inset space ~
1550 characters to insert:
1551 \begin_inset VSpace defskip
1555 \begin_inset Newline newline
1559 \begin_inset Flex TextField
1562 \begin_layout Plain Layout
1563 \begin_inset Argument 1
1566 \begin_layout Plain Layout
1572 Enter your name here:
1580 \begin_layout Standard
1581 \begin_inset Note Greyedout
1584 \begin_layout Plain Layout
1597 custom background colors you must disable in these programs the highlighting
1600 \begin_inset Quotes eld
1603 Show border hover color for fields
1604 \begin_inset Quotes erd
1615 \begin_layout Itemize
1616 Check box with normal border and symbol
1619 \begin_inset VSpace defskip
1623 \begin_inset Newline newline
1627 \begin_inset Flex CheckBox
1630 \begin_layout Plain Layout
1631 \begin_inset Argument 1
1634 \begin_layout Plain Layout
1640 Are you older than 18 years?
1648 \begin_layout Standard
1649 The symbol is either specified as number or with the command
1650 \begin_inset Newline newline
1660 \begin_inset Newline newline
1667 is one of the possible numbers listed in Table
1668 \begin_inset space ~
1671 2 of the documentation of the \SpecialChar LaTeX
1677 \begin_inset CommandInset citation
1687 \begin_layout Itemize
1688 Combo choice menu with dashed, colored border where the last entry is preselecte
1690 \begin_inset VSpace defskip
1694 \begin_inset Newline newline
1698 \begin_inset Flex ChoiceMenu
1701 \begin_layout Plain Layout
1702 \begin_inset Argument 1
1705 \begin_layout Plain Layout
1706 combo, name=combo2, default=Az
1711 Albania=Al, Armenia=Ar, Azerbaidschan=Az
1712 \begin_inset Argument 2
1715 \begin_layout Plain Layout
1729 \begin_layout Itemize
1730 Popdown choice menu where the second entry is preselected:
1731 \begin_inset VSpace defskip
1735 \begin_inset Newline newline
1739 \begin_inset Flex ChoiceMenu
1742 \begin_layout Plain Layout
1743 \begin_inset Argument 1
1746 \begin_layout Plain Layout
1747 popdown, name=country2, default=Ar
1752 Albania=Al, Armenia=Ar, Azerbaidschan=Az
1753 \begin_inset Argument 2
1756 \begin_layout Plain Layout
1770 \begin_layout Standard
1771 \begin_inset VSpace defskip
1775 \begin_inset Note Greyedout
1778 \begin_layout Plain Layout
1795 have no effect for popdown choice menus.
1803 \begin_layout Itemize
1804 Radio choice menu with inverted bevel border and symbol number
1805 \begin_inset space ~
1809 \begin_inset VSpace defskip
1813 \begin_inset Newline newline
1817 \begin_inset Flex ChoiceMenu
1820 \begin_layout Plain Layout
1821 \begin_inset Argument 1
1824 \begin_layout Plain Layout
1831 \begin_inset Argument 2
1834 \begin_layout Plain Layout
1848 \begin_layout Standard
1849 \begin_inset VSpace defskip
1853 \begin_inset Note Greyedout
1856 \begin_layout Plain Layout
1877 have no effect for push, submit and reset buttons.
1885 \begin_layout Standard
1886 As workaround use a colored box and/or color the box text.
1889 \begin_layout Itemize
1890 Push button with a bevel border and colored text:
1891 \begin_inset VSpace defskip
1895 \begin_inset Newline newline
1899 \begin_inset Flex PushButton
1902 \begin_layout Plain Layout
1903 \begin_inset Argument 1
1906 \begin_layout Plain Layout
1911 \begin_layout Plain Layout
1918 Why do you click this?
1922 \begin_layout Plain Layout
1935 \begin_inset Box Frameless
1945 height_special "totalheight"
1950 backgroundcolor "lime"
1953 \begin_layout Plain Layout
1956 Don't click on this button!!!
1967 \begin_inset VSpace bigskip
1973 \begin_layout Itemize
1974 Submit button without border, with cyan background and increased height:
1975 \begin_inset VSpace defskip
1979 \begin_inset Newline newline
1983 \begin_inset Flex SubmitButton
1986 \begin_layout Plain Layout
1987 \begin_inset Argument 1
1990 \begin_layout Plain Layout
1997 \begin_inset Box Frameless
2007 height_special "totalheight"
2012 backgroundcolor "cyan"
2015 \begin_layout Plain Layout
2016 \begin_inset Box Frameless
2026 height_special "totalheight"
2031 backgroundcolor "none"
2034 \begin_layout Plain Layout
2035 Send your data via mail
2051 \begin_inset VSpace bigskip
2057 \begin_layout Itemize
2058 Reset button with a width of 7
2059 \begin_inset space \thinspace{}
2063 \begin_inset VSpace defskip
2067 \begin_inset Newline newline
2071 \begin_inset Flex ResetButton
2074 \begin_layout Plain Layout
2075 \begin_inset Argument 1
2078 \begin_layout Plain Layout
2085 \begin_inset Box Frameless
2095 height_special "totalheight"
2100 backgroundcolor "none"
2103 \begin_layout Plain Layout
2117 \begin_layout Standard
2118 \begin_inset Newpage newpage
2124 \begin_layout Section
2128 \begin_layout Standard
2129 One often needs basic actions to be done by the PDF viewer program, for
2130 example to print the form.
2131 Such PDF program-specific actions can be triggered by adding inserting
2145 can handle all possible actions while other PDF viewers might only support
2147 However, all PDF viewers support the basic things like printing, save
2148 \begin_inset space ~
2151 as, view in fullscreen etc..
2154 \begin_layout Standard
2155 To specify the action insert its name to the
2160 A list with possible action names can be found in sec.
2161 \begin_inset space \thinspace{}
2165 \begin_inset Quotes eld
2168 Acrobat-specific behavior
2169 \begin_inset Quotes erd
2172 of the documentation of the \SpecialChar LaTeX
2178 \begin_inset CommandInset citation
2188 \begin_layout Standard
2189 Here are some examples:
2192 \begin_layout Description
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 Flex PDFAction
2224 \begin_layout Plain Layout
2225 \begin_inset Argument 1
2228 \begin_layout Plain Layout
2242 \begin_layout Description
2244 \begin_inset space ~
2248 \begin_inset space ~
2252 \begin_inset Flex PDFAction
2255 \begin_layout Plain Layout
2256 \begin_inset Argument 1
2259 \begin_layout Plain Layout
2265 View the form in fullscreen
2273 \begin_layout Subsection
2274 Action button customization
2275 \begin_inset CommandInset label
2277 name "subsec:Action-button-customization"
2284 \begin_layout Standard
2285 Customizing the action buttons requires the usage of boxes because things
2286 like the width, height and border separation cannot be specified as button
2290 \begin_layout Standard
2291 The easiest way to customize the buttons is to fill it with a custom box.
2292 For example the button should be 5
2293 \begin_inset space \thinspace{}
2296 cm wide and have the height of 2
2297 \begin_inset space ~
2301 Then create this parbox:
2304 \begin_layout Standard
2305 \begin_inset Box Frameless
2315 height_special "totalheight"
2320 backgroundcolor "none"
2323 \begin_layout Plain Layout
2333 \begin_layout Standard
2342 \begin_layout Standard
2343 \begin_inset Flex PDFAction
2346 \begin_layout Plain Layout
2347 \begin_inset Argument 1
2350 \begin_layout Plain Layout
2357 \begin_inset Box Frameless
2367 height_special "totalheight"
2372 backgroundcolor "none"
2375 \begin_layout Plain Layout
2389 \begin_layout PDF Link Setup
2391 \begin_inset Note Note
2394 \begin_layout Plain Layout
2395 Sets the thickness of the predefined link border to zero as described below.
2403 \begin_layout Standard
2404 To customize the border color, border thickness and the distance to the
2405 border one changes the border settings of the box.
2407 \begin_inset space \thinspace{}
2410 pt thick, teal border and 3
2411 \begin_inset space \thinspace{}
2414 pt border separation :
2415 \begin_inset VSpace defskip
2419 \begin_inset Newline newline
2423 \begin_inset Flex PDFAction
2426 \begin_layout Plain Layout
2427 \begin_inset Argument 1
2430 \begin_layout Plain Layout
2437 \begin_inset Box Boxed
2447 height_special "totalheight"
2452 backgroundcolor "white"
2455 \begin_layout Plain Layout
2470 \begin_layout Standard
2471 To customize the border thickness, add the command
2475 to the additional options in the document settings under
2478 \begin_inset space ~
2487 with a number that is the thickness in pixels.
2488 If you want to change the border thickness only for certain buttons, use
2492 \begin_inset space ~
2496 \begin_inset space ~
2501 before the button and insert there the command
2506 The default value of
2517 \begin_layout Standard
2518 \begin_inset Note Greyedout
2521 \begin_layout Plain Layout
2530 affects all link types, not only the action links.
2538 \begin_layout PDF Link Setup
2542 \begin_layout Standard
2544 \begin_inset space ~
2548 \begin_inset Newline newline
2552 \begin_inset Flex PDFAction
2555 \begin_layout Plain Layout
2556 \begin_inset Argument 1
2559 \begin_layout Plain Layout
2566 \begin_inset Box Frameless
2576 height_special "totalheight"
2581 backgroundcolor "none"
2584 \begin_layout Plain Layout
2599 \begin_layout Standard
2600 To change the border color use the command
2602 menubordercolor={r g b}
2616 are numbers between 0 and 1 for the colors red, green and blue.
2617 The default value of
2628 \begin_layout PDF Link Setup
2629 pdfborder={0 0 1}, menubordercolor={0.1 0.9 0.5}
2632 \begin_layout Standard
2635 menubordercolor={0.1 0.9 0.5}
2638 \begin_inset Newline newline
2642 \begin_inset Flex PDFAction
2645 \begin_layout Plain Layout
2646 \begin_inset Argument 1
2649 \begin_layout Plain Layout
2656 \begin_inset Box Frameless
2666 height_special "totalheight"
2671 backgroundcolor "none"
2674 \begin_layout Plain Layout
2689 \begin_layout Standard
2690 To change the background color use a colored box.
2693 \begin_layout PDF Link Setup
2697 \begin_layout Standard
2698 An example without a border and with lime background color:
2699 \begin_inset Newline newline
2703 \begin_inset Flex PDFAction
2706 \begin_layout Plain Layout
2707 \begin_inset Argument 1
2710 \begin_layout Plain Layout
2717 \begin_inset Box Frameless
2727 height_special "totalheight"
2732 backgroundcolor "lime"
2735 \begin_layout Plain Layout
2750 \begin_layout PDF Link Setup
2751 pdfborder={0 0 1}, menubordercolor={1 0 0}
2754 \begin_layout Section
2755 Dynamic form elements
2758 \begin_layout Standard
2759 It is also possible to have dynamic form elements.
2760 This means that depending on the actions of the user elements can (dis)appear
2761 or change their appearance.
2762 To use this feature, add these lines to your LaTeX preamble:
2765 \begin_layout Standard
2770 usepackage[pdftex]{insdljs}
2771 \begin_inset Newline newline
2785 \begin_layout Standard
2786 Then add the necessary JavaScript code to your document LaTeX preamble or
2788 code to your document.
2789 For info about JavaScript, see its documentation,
2790 \begin_inset CommandInset citation
2800 \begin_layout Standard
2804 \begin_layout Plain Layout
2814 \begin_inset Note Note
2817 \begin_layout Plain Layout
2818 The following section will only be displayed when the \SpecialChar LaTeX
2831 \begin_layout Standard
2832 For the following choice menu this JavaScript code was used:
2835 \begin_layout Standard
2836 \begin_inset listings
2837 lstparams "language=TeX"
2841 \begin_layout Plain Layout
2845 begin{insDLJS}[exaaae]{exaaae}{JavaScript}
2848 \begin_layout Plain Layout
2850 function validateTime(){
2853 \begin_layout Plain Layout
2858 \begin_layout Plain Layout
2860 if((event.value == "u") || (event.value == "unlimited")) {
2863 \begin_layout Plain Layout
2865 this.getField("from").display = display.hidden;
2868 \begin_layout Plain Layout
2870 this.getField("until").display = display.hidden;
2873 \begin_layout Plain Layout
2878 \begin_layout Plain Layout
2880 this.getField("from").display = display.visible;
2883 \begin_layout Plain Layout
2885 this.getField("until").display = display.visible;
2888 \begin_layout Plain Layout
2890 this.getField("from").setFocus();
2893 \begin_layout Plain Layout
2898 \begin_layout Plain Layout
2903 \begin_layout Plain Layout
2908 \begin_layout Plain Layout
2920 \begin_layout Standard
2921 \begin_inset Note Greyedout
2924 \begin_layout Plain Layout
2933 JavaScript functions must be inserted into the same
2945 \begin_layout Standard
2950 of the following choice menu are
2951 \begin_inset Newline newline
2956 name=contract,radio,default=tl,validate={validateTime();}
2959 \begin_layout Standard
2960 \begin_inset Flex ChoiceMenu
2963 \begin_layout Plain Layout
2964 \begin_inset Argument 1
2967 \begin_layout Plain Layout
2968 name=contract,radio,default=tl,validate={validateTime();}
2973 term-limited=tl, unlimited=u
2974 \begin_inset Argument 2
2977 \begin_layout Plain Layout
2989 \begin_inset VSpace defskip
2995 \begin_layout Standard
2996 \begin_inset Tabular
2997 <lyxtabular version="3" rows="3" columns="2">
2998 <features tabularvalignment="middle">
2999 <column alignment="left" valignment="top">
3000 <column alignment="center" valignment="top">
3002 <cell alignment="left" valignment="top" usebox="none">
3005 \begin_layout Plain Layout
3011 <cell alignment="center" valignment="top" usebox="none">
3014 \begin_layout Plain Layout
3015 \begin_inset Flex TextField
3018 \begin_layout Plain Layout
3019 \begin_inset Argument 1
3022 \begin_layout Plain Layout
3023 name=from,width=10em
3040 <cell alignment="center" valignment="top" usebox="none">
3043 \begin_layout Plain Layout
3049 <cell alignment="center" valignment="top" usebox="none">
3052 \begin_layout Plain Layout
3053 \begin_inset VSpace -1.5mm
3063 <cell alignment="left" valignment="top" usebox="none">
3066 \begin_layout Plain Layout
3072 <cell alignment="center" valignment="top" usebox="none">
3075 \begin_layout Plain Layout
3076 \begin_inset Flex TextField
3079 \begin_layout Plain Layout
3080 \begin_inset Argument 1
3083 \begin_layout Plain Layout
3084 name=until,width=10em
3107 \begin_layout Standard
3108 \begin_inset VSpace bigskip
3114 \begin_layout Standard
3115 To check and assure that the user only enters a number to a text field you
3116 can for example use this JavaScript code:
3119 \begin_layout Standard
3120 \begin_inset listings
3121 lstparams "language=TeX"
3125 \begin_layout Plain Layout
3127 function checkNumber() {
3130 \begin_layout Plain Layout
3135 \begin_layout Plain Layout
3137 if (!Number(event.value)) {
3140 \begin_layout Plain Layout
3142 app.alert("Value must be a number!");
3145 \begin_layout Plain Layout
3150 \begin_layout Plain Layout
3155 \begin_layout Plain Layout
3157 event.target.textColor = color.green;
3160 \begin_layout Plain Layout
3170 \begin_layout Standard
3171 An example text field:
3172 \begin_inset Flex TextField
3175 \begin_layout Plain Layout
3176 \begin_inset Argument 1
3179 \begin_layout Plain Layout
3180 name=onlyNumbers, align=1, validate={checkNumber();}
3193 \begin_layout Standard
3197 \begin_layout Plain Layout
3207 \begin_inset Note Note
3210 \begin_layout Plain Layout
3211 The following will be displayed when the \SpecialChar LaTeX
3224 \begin_layout Standard
3225 You need to install the package
3229 to see the content of this section in the output.
3232 \begin_layout Standard
3236 \begin_layout Plain Layout
3248 \begin_layout End PDF Form
3249 \begin_inset Note Note
3252 \begin_layout Plain Layout
3261 \begin_layout Section
3265 \begin_layout Itemize
3266 Submitting and applying data requires that all form elements have a name.
3269 \begin_layout Itemize
3270 Creating a PDF form requires pdf\SpecialChar TeX
3271 or Lua\SpecialChar TeX
3273 Use therefore either the \SpecialChar LyX
3285 \begin_layout Itemize
3294 custom background colors you must disable in these programs the highlighting
3297 \begin_inset Quotes eld
3300 Show border hover color for fields
3301 \begin_inset Quotes erd
3307 \begin_layout Bibliography
3308 \begin_inset CommandInset bibitem
3309 LatexCommand bibitem
3316 \begin_inset CommandInset href
3318 name "JavaScript reference"
3319 target "https://developer.mozilla.org/en/docs/Web/JavaScript/Reference"
3327 \begin_layout Bibliography
3328 \begin_inset CommandInset bibitem
3329 LatexCommand bibitem
3336 \begin_inset CommandInset href
3338 name "Documentation"
3339 target "https://ctan.org/tex-archive/macros/latex/contrib/hyperref/doc/manual.pdf"
3344 of the \SpecialChar LaTeX
3350 \begin_layout Bibliography
3351 \begin_inset CommandInset bibitem
3352 LatexCommand bibitem
3359 \begin_inset CommandInset href
3361 name "Documentation"
3362 target "https://ctan.org/tex-archive/macros/latex/required/psnfss/psnfss2e.pdf"
3367 of the \SpecialChar LaTeX