1 #LyX 2.4 created this file. For more info see https://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 \setlength{\parskip}{\medskipamount}
65 \setlength{\parindent}{0pt}
67 \options BCOR8mm,pagesize
68 \use_default_options false
72 \maintain_unincluded_children no
74 \language_package default
77 \font_roman "default" "default"
78 \font_sans "default" "default"
79 \font_typewriter "default" "default"
80 \font_math "auto" "auto"
81 \font_default_family default
82 \use_non_tex_fonts false
85 \font_typewriter_osf false
87 \font_sf_scale 100 100
88 \font_tt_scale 100 100
90 \use_dash_ligatures false
92 \default_output_format pdf2
94 \bibtex_command bibtex
95 \index_command default
99 \pdf_title "Description of the module pdfcomment"
100 \pdf_author "Uwe Stöhr"
101 \pdf_subject "PDF form"
102 \pdf_keywords "LyX, PDF forms, hyperref"
104 \pdf_bookmarksnumbered true
105 \pdf_bookmarksopen true
106 \pdf_bookmarksopenlevel 2
107 \pdf_breaklinks false
109 \pdf_colorlinks false
111 \pdf_pdfusetitle false
112 \pdf_quoted_options "pdfpagelayout=OneColumn, pdfnewwindow=true, pdfstartview=XYZ, plainpages=false, urlbordercolor={1 0 0}"
115 \use_package amsmath 1
116 \use_package amssymb 1
117 \use_package cancel 1
119 \use_package mathdots 1
120 \use_package mathtools 1
121 \use_package mhchem 1
122 \use_package stackrel 1
123 \use_package stmaryrd 1
124 \use_package undertilde 1
126 \cite_engine_type default
130 \paperorientation portrait
135 \notefontcolor #0000ff
143 \paragraph_separation indent
144 \paragraph_indentation default
146 \math_numbering_side default
147 \quotes_style english
151 \paperpagestyle default
152 \tracking_changes false
153 \postpone_fragile_content false
154 \output_changes false
157 \html_be_strict false
162 \begin_layout Begin PDF Form
163 \begin_inset Argument 1
166 \begin_layout Plain Layout
168 action=mailto:forms@lyx.test?subject=The submitted PDF form, method=post
177 Description of the module PDF Form
184 \begin_layout Standard
185 \begin_inset Note Note
188 \begin_layout Plain Layout
189 To export all parts of this document to PDF the \SpecialChar LaTeX
195 If it is not installed you can export the document anyway but the example
196 in the section about dynamic form elements will not appear in the output.
204 \begin_layout Standard
205 By loading the module PDF
209 Form the whole document or a part of it can be made a PDF form.
210 You can add all possible form elements like text fields buttons etc.
211 This document describes how this is done.
214 \begin_layout Section
216 \begin_inset CommandInset label
218 name "sec:Preparation"
225 \begin_layout Standard
226 At first load the module PDF
230 Form in the document settings of your file.
231 To make the whole document a form, insert the environment
243 from \SpecialChar LyX
244 's dropdown menu at the beginning of the document.
245 If only a part of the document should be a form, add
257 at the position where the form should start.
260 \begin_layout Standard
261 \begin_inset Note Greyedout
264 \begin_layout Plain Layout
269 It is only possible to have one form in a PDF file!
277 \begin_layout Standard
278 If the form data should be submitted to a server or the like, then you must
279 specify the URL as parameter of the
292 This is done by using the menu
294 Insert\SpecialChar menuseparator
306 For example in this document the following was inserted to the parameter
310 \begin_layout Standard
313 action=mailto:forms@lyx.test?subject=The submitted PDF form,
314 \begin_inset Newline newline
320 \begin_layout Standard
321 This sends the form data as email to
325 when the user presses the submit button.
326 The email subject will be
327 \begin_inset Quotes eld
330 The submitted PDF form
331 \begin_inset Quotes erd
334 and the submit method is
339 (The other possible method would be
343 .) For more about submitting see sec.
344 \begin_inset space \thinspace{}
348 \begin_inset CommandInset ref
350 reference "subsec:Submit-button"
357 \begin_layout Standard
358 \begin_inset Newpage newpage
364 \begin_layout Section
368 \begin_layout Standard
373 possible elements in a PDF form:
376 \begin_layout Subsection
380 \begin_layout Standard
381 A text field is added by inserting the custom inset
387 Insert\SpecialChar menuseparator
395 Write inside the inset the label for the text field that will be printed
396 in the PDF output before the field.
398 \begin_inset Newline newline
402 \begin_inset Flex TextField
405 \begin_layout Plain Layout
406 \begin_inset Argument 1
409 \begin_layout Plain Layout
415 Enter your name here:
423 \begin_layout Standard
424 You must also specify a name for text fields.
425 To do this set the cursor into its
429 inset and insert the parameter
440 \begin_layout Standard
441 Using the same name for several text fields results in an automatic duplication
442 of the inserted text.
443 This is for example useful if the user should input a date that should
444 appear at different places in the form.
445 \begin_inset Newline newline
452 fields as example: Fill one and see that the other one will be filled automatica
453 lly when you click outside of the field:
454 \begin_inset Newline newline
458 \begin_inset Flex TextField
461 \begin_layout Plain Layout
462 \begin_inset Argument 1
465 \begin_layout Plain Layout
477 \begin_inset Newline newline
481 \begin_inset Flex TextField
484 \begin_layout Plain Layout
485 \begin_inset Argument 1
488 \begin_layout Plain Layout
502 \begin_layout Standard
503 \begin_inset Note Greyedout
506 \begin_layout Plain Layout
511 Special characters should be avoided in element names.
519 \begin_layout Standard
520 All form fields can be customized by adding parameters.
523 \begin_layout Standard
524 Here is a customized multiline text field with a width of 60
525 \begin_inset space \thinspace{}
528 % of the text width, 3
529 \begin_inset space \thinspace{}
532 cm height and a proposed content:
533 \begin_inset VSpace defskip
537 \begin_inset Newline newline
541 \begin_inset Flex TextField
544 \begin_layout Plain Layout
545 \begin_inset Argument 1
548 \begin_layout Plain Layout
549 name=customer2, multiline, width=0.6
551 textwidth, height=3cm, value={proposed text}
556 Enter your name here:
564 \begin_layout Standard
565 \begin_inset Note Greyedout
568 \begin_layout Plain Layout
573 It is highly recommended to use a uniform layout of all fields in a form.
575 \begin_inset space \thinspace{}
579 \begin_inset CommandInset ref
581 reference "sec:Form-element-customization"
593 \begin_layout Subsection
597 \begin_layout Standard
598 A check box is added by inserting the custom inset
603 Write inside the inset the label for the box.
605 \begin_inset Newline newline
609 \begin_inset Flex CheckBox
612 \begin_layout Plain Layout
613 \begin_inset Argument 1
616 \begin_layout Plain Layout
622 Are you older than 18 years?
630 \begin_layout Standard
631 You must specify also for check boxes a name.
633 \begin_inset space \thinspace{}
637 \begin_inset space \space{}
648 is the name) into the
655 \begin_layout Subsection
659 \begin_layout Standard
660 A choice menu is added by inserting the custom inset
665 A label for the inset is added by using the menu
667 Insert\SpecialChar menuseparator
671 The different choices are inserted to the inset as comma-separated list.
679 \begin_layout Description
680 Radio Only one choice can be selected
683 \begin_layout Description
684 Combo The choices are listed in a combo box (dropdown list) but the user
685 is allowed to input something that is not in the predefined list.
688 \begin_layout Description
689 Popdown All choices are listed below each other.
690 If the menu is not high enough a scroll bar is automatically added.
693 \begin_layout Standard
694 To determine the choice menu type one uses the parameter
709 \begin_layout Standard
710 Here is an example for the radio type:
711 \begin_inset VSpace defskip
715 \begin_inset Newline newline
719 \begin_inset Flex ChoiceMenu
722 \begin_layout Plain Layout
723 \begin_inset Argument 1
726 \begin_layout Plain Layout
733 \begin_inset Argument 2
736 \begin_layout Plain Layout
750 \begin_layout Standard
751 Here is an example for the combo type:
752 \begin_inset VSpace defskip
756 \begin_inset Newline newline
760 \begin_inset Flex ChoiceMenu
763 \begin_layout Plain Layout
764 \begin_inset Argument 1
767 \begin_layout Plain Layout
773 Albania=Al, Armenia=Ar, Azerbaidschan=Az
774 \begin_inset Argument 2
777 \begin_layout Plain Layout
791 \begin_layout Standard
792 Here is an example for the popdown type:
793 \begin_inset VSpace defskip
797 \begin_inset Newline newline
801 \begin_inset Flex ChoiceMenu
804 \begin_layout Plain Layout
805 \begin_inset Argument 1
808 \begin_layout Plain Layout
809 popdown, name=country
814 Albania=Al, Armenia=Ar, Azerbaidschan=Az
815 \begin_inset Argument 2
818 \begin_layout Plain Layout
832 \begin_layout Standard
833 You must also specify a name for choice menus.
834 Insert for example the parameter
842 is the name) into the
849 \begin_layout Standard
850 It is recommended to add a short name for every choice to be able to access
851 them and to know which one was chosen by the user.
852 This is done by adding
856 behind each choice (where
861 For example the radio type example contains this choice list:
867 \begin_inset Quotes eld
871 \begin_inset Quotes erd
874 you know that he chose the choice
875 \begin_inset Quotes eld
879 \begin_inset Quotes erd
883 With the name you can also preset/propose e.g.
884 \begin_inset space \space{}
888 \begin_inset Quotes eld
892 \begin_inset Quotes erd
895 by adding the parameter
903 \begin_layout Standard
904 \begin_inset Flex ChoiceMenu
907 \begin_layout Plain Layout
908 \begin_inset Argument 1
911 \begin_layout Plain Layout
912 radio, name=sex, default=m
918 \begin_inset Argument 2
921 \begin_layout Plain Layout
935 \begin_layout Subsection
939 \begin_layout Standard
940 A push button is added by inserting the custom inset
945 Write inside the inset the label for the button.
949 \begin_layout Standard
950 \begin_inset Flex PushButton
953 \begin_layout Plain Layout
954 \begin_inset Argument 1
957 \begin_layout Plain Layout
963 Don't click on this button or your fridge will be destroyed!!!
971 \begin_layout Standard
972 The action that is triggered by pressing the button is specified by JavaScript
974 To do this, add the parameter
978 and insert the JavaScript code between the braces.
979 For info about JavaScript, see its documentation,
980 \begin_inset CommandInset citation
988 In the following example this JavaScript code was used:
989 \begin_inset Newline newline
998 \begin_layout Plain Layout
1005 What the hell? Now you destroyed your fridge.
1007 \begin_inset Quotes eld
1011 \begin_inset Quotes erd
1018 \begin_layout Plain Layout
1028 \begin_layout Standard
1029 \begin_inset Flex PushButton
1032 \begin_layout Plain Layout
1033 \begin_inset Argument 1
1036 \begin_layout Plain Layout
1041 \begin_layout Plain Layout
1048 What the hell? Now you destroyed your fridge.
1050 \begin_inset Quotes eld
1054 \begin_inset Quotes erd
1061 \begin_layout Plain Layout
1073 Don't click on this button or your fridge will be destroyed!!!
1081 \begin_layout Standard
1082 \begin_inset Note Greyedout
1085 \begin_layout Plain Layout
1090 The outer quotes are part of the JavaScript code and must therefore be
1091 inserted as \SpecialChar TeX
1100 \begin_layout Standard
1101 A common usage for push buttons is to open a weblink.
1102 Such a button is created by inserting a hyperlink as button text.
1106 \begin_layout Standard
1107 \begin_inset Flex PushButton
1110 \begin_layout Plain Layout
1111 \begin_inset Argument 1
1114 \begin_layout Plain Layout
1121 \begin_inset CommandInset href
1123 name "Information how to fill out this form"
1124 target "https://wiki.lyx.org"
1137 \begin_layout Standard
1138 To get rid of the predefined frame for weblinks add this to the additional
1139 options in the document settings under
1142 \begin_inset space ~
1150 \begin_layout Standard
1153 urlbordercolor={1 0 0}
1156 \begin_layout Standard
1157 if your push button border color is red (the default), otherwise use the
1158 same color definition as for your push button border color.
1161 \begin_layout Subsection
1163 \begin_inset CommandInset label
1165 name "subsec:Submit-button"
1172 \begin_layout Standard
1173 A submit button is used to submit the form data to a server.
1174 It is added by inserting the custom inset
1179 The label for the button is written into the inset.
1183 \begin_layout Standard
1184 \begin_inset Flex SubmitButton
1187 \begin_layout Plain Layout
1188 \begin_inset Argument 1
1191 \begin_layout Plain Layout
1197 Send your data via email
1205 \begin_layout Standard
1206 The submit button creates a forms data format (FDF) file (file extension
1207 *.fdf) which is then submitted.
1208 The FDF file contains only the form data.
1209 They can later only be applied to a PDF form if all elements in the form
1213 \begin_layout Standard
1214 \begin_inset Note Greyedout
1217 \begin_layout Plain Layout
1222 You can only use a submit button if you specified the submit method and
1223 a target in the inset
1226 \begin_inset space ~
1230 \begin_inset space ~
1236 \begin_inset space \thinspace{}
1240 \begin_inset CommandInset ref
1242 reference "sec:Preparation"
1246 for the description.
1247 If there are no specifications you will get \SpecialChar LaTeX
1256 \begin_layout Subsection
1260 \begin_layout Standard
1261 A reset button is used to reset all form elements to the initial state.
1262 It is added by inserting the custom inset
1267 The label for the button is written into the inset.
1271 \begin_layout Standard
1272 \begin_inset Flex ResetButton
1275 \begin_layout Plain Layout
1276 \begin_inset Argument 1
1279 \begin_layout Plain Layout
1293 \begin_layout Section
1294 Form element customization
1295 \begin_inset CommandInset label
1297 name "sec:Form-element-customization"
1304 \begin_layout Standard
1305 Since all form elements should look uniform, one can determine their layout
1306 using the following styles:
1309 \begin_layout Description
1311 \begin_inset space ~
1315 \begin_inset space ~
1321 \begin_layout Description
1323 \begin_inset space ~
1327 \begin_inset space ~
1333 \begin_layout Description
1335 \begin_inset space ~
1339 \begin_inset space ~
1342 Style affects all choice menu types
1345 \begin_layout Description
1347 \begin_inset space ~
1351 \begin_inset space ~
1354 Style affects only the combo box style
1357 \begin_layout Description
1359 \begin_inset space ~
1363 \begin_inset space ~
1366 Style affects only the popdown box style
1369 \begin_layout Description
1371 \begin_inset space ~
1375 \begin_inset space ~
1378 Style affects only the radio box style
1381 \begin_layout Description
1383 \begin_inset space ~
1387 \begin_inset space ~
1393 \begin_layout Description
1395 \begin_inset space ~
1399 \begin_inset space ~
1405 \begin_layout Description
1407 \begin_inset space ~
1411 \begin_inset space ~
1417 \begin_layout Standard
1418 The content of the styles is a comma-separated list of parameters.
1419 The possible parameters are listed in sec.
1420 \begin_inset space \thinspace{}
1424 \begin_inset Quotes eld
1427 Forms optional parameters
1428 \begin_inset Quotes erd
1431 of the documentation of the \SpecialChar LaTeX
1437 \begin_inset CommandInset citation
1445 It is important that the parameter
1449 is always part of the definition.
1450 Otherwise the elements will not appear in the PDF.
1451 The defined style is applied to all elements following the definition.
1454 \begin_layout Subsubsection*
1455 Here are some examples:
1458 \begin_layout Text Field Style
1459 print, bordercolor=red, borderstyle=U, backgroundcolor=lightgray, color=lime,
1460 maxlen=10, align=2, charsize=16pt
1461 \begin_inset Note Note
1464 \begin_layout Plain Layout
1497 \begin_layout Check Box Style
1498 print, borderstyle=S, checkboxsymbol=
1503 \begin_layout Combo Box Style
1504 print, bordercolor={0.33 0.66 0.33}, borderstyle=D
1507 \begin_layout Popdown Box Style
1509 \begin_inset Note Note
1512 \begin_layout Plain Layout
1517 determines the number of displayed menu entries.
1518 It does not work currently because of a bug in the \SpecialChar LaTeX
1531 \begin_layout Radio Box Style
1532 print, borderstyle=I, radiosymbol=3
1535 \begin_layout Push Button Style
1536 print, borderstyle=B, bordercolor=lime
1539 \begin_layout Submit Button Style
1540 print, borderwidth=0, bordercolor=white
1543 \begin_layout Reset Button Style
1544 print, bordercolor=lime
1547 \begin_layout Itemize
1548 Text field with gray background, lime text color, a red border only below
1549 the field, right alignment, 16
1550 \begin_inset space \thinspace{}
1553 pt font size and a limitation for maximal 10
1554 \begin_inset space ~
1557 characters to insert:
1558 \begin_inset VSpace defskip
1562 \begin_inset Newline newline
1566 \begin_inset Flex TextField
1569 \begin_layout Plain Layout
1570 \begin_inset Argument 1
1573 \begin_layout Plain Layout
1579 Enter your name here:
1587 \begin_layout Standard
1588 \begin_inset Note Greyedout
1591 \begin_layout Plain Layout
1604 custom background colors you must disable in these programs the highlighting
1607 \begin_inset Quotes eld
1610 Show border hover color for fields
1611 \begin_inset Quotes erd
1622 \begin_layout Itemize
1623 Check box with normal border and symbol
1626 \begin_inset VSpace defskip
1630 \begin_inset Newline newline
1634 \begin_inset Flex CheckBox
1637 \begin_layout Plain Layout
1638 \begin_inset Argument 1
1641 \begin_layout Plain Layout
1647 Are you older than 18 years?
1655 \begin_layout Standard
1656 The symbol is either specified as number or with the command
1657 \begin_inset Newline newline
1667 \begin_inset Newline newline
1674 is one of the possible numbers listed in Table
1675 \begin_inset space ~
1678 2 of the documentation of the \SpecialChar LaTeX
1684 \begin_inset CommandInset citation
1694 \begin_layout Itemize
1695 Combo choice menu with dashed, colored border where the last entry is preselecte
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 choice menu where the second entry is preselected:
1738 \begin_inset VSpace defskip
1742 \begin_inset Newline newline
1746 \begin_inset Flex ChoiceMenu
1749 \begin_layout Plain Layout
1750 \begin_inset Argument 1
1753 \begin_layout Plain Layout
1754 popdown, name=country2, default=Ar
1759 Albania=Al, Armenia=Ar, Azerbaidschan=Az
1760 \begin_inset Argument 2
1763 \begin_layout Plain Layout
1777 \begin_layout Standard
1778 \begin_inset VSpace defskip
1782 \begin_inset Note Greyedout
1785 \begin_layout Plain Layout
1802 have no effect for popdown choice menus.
1810 \begin_layout Itemize
1811 Radio choice menu with inverted bevel border and symbol number
1812 \begin_inset space ~
1816 \begin_inset VSpace defskip
1820 \begin_inset Newline newline
1824 \begin_inset Flex ChoiceMenu
1827 \begin_layout Plain Layout
1828 \begin_inset Argument 1
1831 \begin_layout Plain Layout
1838 \begin_inset Argument 2
1841 \begin_layout Plain Layout
1855 \begin_layout Standard
1856 \begin_inset VSpace defskip
1860 \begin_inset Note Greyedout
1863 \begin_layout Plain Layout
1884 have no effect for push, submit and reset buttons.
1892 \begin_layout Standard
1893 As workaround use a colored box and/or color the box text.
1896 \begin_layout Itemize
1897 Push button with a bevel border and colored text:
1898 \begin_inset VSpace defskip
1902 \begin_inset Newline newline
1906 \begin_inset Flex PushButton
1909 \begin_layout Plain Layout
1910 \begin_inset Argument 1
1913 \begin_layout Plain Layout
1918 \begin_layout Plain Layout
1925 Why do you click this?
1929 \begin_layout Plain Layout
1942 \begin_inset Box Frameless
1952 height_special "totalheight"
1957 backgroundcolor "lime"
1960 \begin_layout Plain Layout
1963 Don't click on this button!!!
1974 \begin_inset VSpace bigskip
1980 \begin_layout Itemize
1981 Submit button without border, with cyan background and increased height:
1982 \begin_inset VSpace defskip
1986 \begin_inset Newline newline
1990 \begin_inset Flex SubmitButton
1993 \begin_layout Plain Layout
1994 \begin_inset Argument 1
1997 \begin_layout Plain Layout
2004 \begin_inset Box Frameless
2014 height_special "totalheight"
2019 backgroundcolor "cyan"
2022 \begin_layout Plain Layout
2023 \begin_inset Box Frameless
2033 height_special "totalheight"
2038 backgroundcolor "none"
2041 \begin_layout Plain Layout
2042 Send your data via mail
2058 \begin_inset VSpace bigskip
2064 \begin_layout Itemize
2065 Reset button with a width of 7
2066 \begin_inset space \thinspace{}
2070 \begin_inset VSpace defskip
2074 \begin_inset Newline newline
2078 \begin_inset Flex ResetButton
2081 \begin_layout Plain Layout
2082 \begin_inset Argument 1
2085 \begin_layout Plain Layout
2092 \begin_inset Box Frameless
2102 height_special "totalheight"
2107 backgroundcolor "none"
2110 \begin_layout Plain Layout
2124 \begin_layout Standard
2125 \begin_inset Newpage newpage
2131 \begin_layout Section
2135 \begin_layout Standard
2136 One often needs basic actions to be done by the PDF viewer program, for
2137 example to print the form.
2138 Such PDF program-specific actions can be triggered by adding inserting
2152 can handle all possible actions while other PDF viewers might only support
2154 However, all PDF viewers support the basic things like printing, save
2155 \begin_inset space ~
2158 as, view in fullscreen etc..
2161 \begin_layout Standard
2162 To specify the action insert its name to the
2167 A list with possible action names can be found in sec.
2168 \begin_inset space \thinspace{}
2172 \begin_inset Quotes eld
2175 Acrobat-specific behavior
2176 \begin_inset Quotes erd
2179 of the documentation of the \SpecialChar LaTeX
2185 \begin_inset CommandInset citation
2195 \begin_layout Standard
2196 Here are some examples:
2199 \begin_layout Description
2201 \begin_inset Flex PDFAction
2204 \begin_layout Plain Layout
2205 \begin_inset Argument 1
2208 \begin_layout Plain Layout
2222 \begin_layout Description
2224 \begin_inset space ~
2228 \begin_inset Flex PDFAction
2231 \begin_layout Plain Layout
2232 \begin_inset Argument 1
2235 \begin_layout Plain Layout
2249 \begin_layout Description
2251 \begin_inset space ~
2255 \begin_inset space ~
2259 \begin_inset Flex PDFAction
2262 \begin_layout Plain Layout
2263 \begin_inset Argument 1
2266 \begin_layout Plain Layout
2272 View the form in fullscreen
2280 \begin_layout Subsection
2281 Action button customization
2282 \begin_inset CommandInset label
2284 name "subsec:Action-button-customization"
2291 \begin_layout Standard
2292 Customizing the action buttons requires the usage of boxes because things
2293 like the width, height and border separation cannot be specified as button
2297 \begin_layout Standard
2298 The easiest way to customize the buttons is to fill it with a custom box.
2299 For example the button should be 5
2300 \begin_inset space \thinspace{}
2303 cm wide and have the height of 2
2304 \begin_inset space ~
2308 Then create this parbox:
2311 \begin_layout Standard
2312 \begin_inset Box Frameless
2322 height_special "totalheight"
2327 backgroundcolor "none"
2330 \begin_layout Plain Layout
2340 \begin_layout Standard
2349 \begin_layout Standard
2350 \begin_inset Flex PDFAction
2353 \begin_layout Plain Layout
2354 \begin_inset Argument 1
2357 \begin_layout Plain Layout
2364 \begin_inset Box Frameless
2374 height_special "totalheight"
2379 backgroundcolor "none"
2382 \begin_layout Plain Layout
2396 \begin_layout PDF Link Setup
2398 \begin_inset Note Note
2401 \begin_layout Plain Layout
2402 Sets the thickness of the predefined link border to zero as described below.
2410 \begin_layout Standard
2411 To customize the border color, border thickness and the distance to the
2412 border one changes the border settings of the box.
2414 \begin_inset space \thinspace{}
2417 pt thick, teal border and 3
2418 \begin_inset space \thinspace{}
2421 pt border separation :
2422 \begin_inset VSpace defskip
2426 \begin_inset Newline newline
2430 \begin_inset Flex PDFAction
2433 \begin_layout Plain Layout
2434 \begin_inset Argument 1
2437 \begin_layout Plain Layout
2444 \begin_inset Box Boxed
2454 height_special "totalheight"
2459 backgroundcolor "white"
2462 \begin_layout Plain Layout
2477 \begin_layout Standard
2478 To customize the border thickness, add the command
2482 to the additional options in the document settings under
2485 \begin_inset space ~
2494 with a number that is the thickness in pixels.
2495 If you want to change the border thickness only for certain buttons, use
2499 \begin_inset space ~
2503 \begin_inset space ~
2508 before the button and insert there the command
2513 The default value of
2524 \begin_layout Standard
2525 \begin_inset Note Greyedout
2528 \begin_layout Plain Layout
2537 affects all link types, not only the action links.
2545 \begin_layout PDF Link Setup
2549 \begin_layout Standard
2551 \begin_inset space ~
2555 \begin_inset Newline newline
2559 \begin_inset Flex PDFAction
2562 \begin_layout Plain Layout
2563 \begin_inset Argument 1
2566 \begin_layout Plain Layout
2573 \begin_inset Box Frameless
2583 height_special "totalheight"
2588 backgroundcolor "none"
2591 \begin_layout Plain Layout
2606 \begin_layout Standard
2607 To change the border color use the command
2609 menubordercolor={r g b}
2623 are numbers between 0 and 1 for the colors red, green and blue.
2624 The default value of
2635 \begin_layout PDF Link Setup
2636 pdfborder={0 0 1}, menubordercolor={0.1 0.9 0.5}
2639 \begin_layout Standard
2642 menubordercolor={0.1 0.9 0.5}
2645 \begin_inset Newline newline
2649 \begin_inset Flex PDFAction
2652 \begin_layout Plain Layout
2653 \begin_inset Argument 1
2656 \begin_layout Plain Layout
2663 \begin_inset Box Frameless
2673 height_special "totalheight"
2678 backgroundcolor "none"
2681 \begin_layout Plain Layout
2696 \begin_layout Standard
2697 To change the background color use a colored box.
2700 \begin_layout PDF Link Setup
2704 \begin_layout Standard
2705 An example without a border and with lime background color:
2706 \begin_inset Newline newline
2710 \begin_inset Flex PDFAction
2713 \begin_layout Plain Layout
2714 \begin_inset Argument 1
2717 \begin_layout Plain Layout
2724 \begin_inset Box Frameless
2734 height_special "totalheight"
2739 backgroundcolor "lime"
2742 \begin_layout Plain Layout
2757 \begin_layout PDF Link Setup
2758 pdfborder={0 0 1}, menubordercolor={1 0 0}
2761 \begin_layout Section
2762 Dynamic form elements
2765 \begin_layout Standard
2766 It is also possible to have dynamic form elements.
2767 This means that depending on the actions of the user elements can (dis)appear
2768 or change their appearance.
2769 To use this feature, add these lines to your LaTeX preamble:
2772 \begin_layout Standard
2777 usepackage[pdftex]{insdljs}
2778 \begin_inset Newline newline
2792 \begin_layout Standard
2793 Then add the necessary JavaScript code to your document LaTeX preamble or
2795 code to your document.
2796 For info about JavaScript, see its documentation,
2797 \begin_inset CommandInset citation
2807 \begin_layout Standard
2811 \begin_layout Plain Layout
2821 \begin_inset Note Note
2824 \begin_layout Plain Layout
2825 The following section will only be displayed when the \SpecialChar LaTeX
2838 \begin_layout Standard
2839 For the following choice menu this JavaScript code was used:
2842 \begin_layout Standard
2843 \begin_inset listings
2844 lstparams "language=TeX"
2848 \begin_layout Plain Layout
2852 begin{insDLJS}[exaaae]{exaaae}{JavaScript}
2855 \begin_layout Plain Layout
2857 function validateTime(){
2860 \begin_layout Plain Layout
2865 \begin_layout Plain Layout
2867 if((event.value == "u") || (event.value == "unlimited")) {
2870 \begin_layout Plain Layout
2872 this.getField("from").display = display.hidden;
2875 \begin_layout Plain Layout
2877 this.getField("until").display = display.hidden;
2880 \begin_layout Plain Layout
2885 \begin_layout Plain Layout
2887 this.getField("from").display = display.visible;
2890 \begin_layout Plain Layout
2892 this.getField("until").display = display.visible;
2895 \begin_layout Plain Layout
2897 this.getField("from").setFocus();
2900 \begin_layout Plain Layout
2905 \begin_layout Plain Layout
2910 \begin_layout Plain Layout
2915 \begin_layout Plain Layout
2927 \begin_layout Standard
2928 \begin_inset Note Greyedout
2931 \begin_layout Plain Layout
2940 JavaScript functions must be inserted into the same
2952 \begin_layout Standard
2957 of the following choice menu are
2958 \begin_inset Newline newline
2963 name=contract,radio,default=tl,validate={validateTime();}
2966 \begin_layout Standard
2967 \begin_inset Flex ChoiceMenu
2970 \begin_layout Plain Layout
2971 \begin_inset Argument 1
2974 \begin_layout Plain Layout
2975 name=contract,radio,default=tl,validate={validateTime();}
2980 term-limited=tl, unlimited=u
2981 \begin_inset Argument 2
2984 \begin_layout Plain Layout
2996 \begin_inset VSpace defskip
3002 \begin_layout Standard
3003 \begin_inset Tabular
3004 <lyxtabular version="3" rows="3" columns="2">
3005 <features tabularvalignment="middle">
3006 <column alignment="left" valignment="top">
3007 <column alignment="center" valignment="top">
3009 <cell alignment="left" valignment="top" usebox="none">
3012 \begin_layout Plain Layout
3018 <cell alignment="center" valignment="top" usebox="none">
3021 \begin_layout Plain Layout
3022 \begin_inset Flex TextField
3025 \begin_layout Plain Layout
3026 \begin_inset Argument 1
3029 \begin_layout Plain Layout
3030 name=from,width=10em
3047 <cell alignment="center" valignment="top" usebox="none">
3050 \begin_layout Plain Layout
3056 <cell alignment="center" valignment="top" usebox="none">
3059 \begin_layout Plain Layout
3060 \begin_inset VSpace -1.5mm
3070 <cell alignment="left" valignment="top" usebox="none">
3073 \begin_layout Plain Layout
3079 <cell alignment="center" valignment="top" usebox="none">
3082 \begin_layout Plain Layout
3083 \begin_inset Flex TextField
3086 \begin_layout Plain Layout
3087 \begin_inset Argument 1
3090 \begin_layout Plain Layout
3091 name=until,width=10em
3114 \begin_layout Standard
3115 \begin_inset VSpace bigskip
3121 \begin_layout Standard
3122 To check and assure that the user only enters a number to a text field you
3123 can for example use this JavaScript code:
3126 \begin_layout Standard
3127 \begin_inset listings
3128 lstparams "language=TeX"
3132 \begin_layout Plain Layout
3134 function checkNumber() {
3137 \begin_layout Plain Layout
3142 \begin_layout Plain Layout
3144 if (!Number(event.value)) {
3147 \begin_layout Plain Layout
3149 app.alert("Value must be a number!");
3152 \begin_layout Plain Layout
3157 \begin_layout Plain Layout
3162 \begin_layout Plain Layout
3164 event.target.textColor = color.green;
3167 \begin_layout Plain Layout
3177 \begin_layout Standard
3178 An example text field:
3179 \begin_inset Flex TextField
3182 \begin_layout Plain Layout
3183 \begin_inset Argument 1
3186 \begin_layout Plain Layout
3187 name=onlyNumbers, align=1, validate={checkNumber();}
3200 \begin_layout Standard
3204 \begin_layout Plain Layout
3214 \begin_inset Note Note
3217 \begin_layout Plain Layout
3218 The following will be displayed when the \SpecialChar LaTeX
3231 \begin_layout Standard
3232 You need to install the package
3236 to see the content of this section in the output.
3239 \begin_layout Standard
3243 \begin_layout Plain Layout
3255 \begin_layout End PDF Form
3256 \begin_inset Note Note
3259 \begin_layout Plain Layout
3268 \begin_layout Section
3272 \begin_layout Itemize
3273 Submitting and applying data requires that all form elements have a name.
3276 \begin_layout Itemize
3277 Creating a PDF form requires pdf\SpecialChar TeX
3278 or Lua\SpecialChar TeX
3280 Use therefore either the \SpecialChar LyX
3292 \begin_layout Itemize
3301 custom background colors you must disable in these programs the highlighting
3304 \begin_inset Quotes eld
3307 Show border hover color for fields
3308 \begin_inset Quotes erd
3314 \begin_layout Bibliography
3315 \begin_inset CommandInset bibitem
3316 LatexCommand bibitem
3323 \begin_inset CommandInset href
3325 name "JavaScript reference"
3326 target "https://developer.mozilla.org/en/docs/Web/JavaScript/Reference"
3334 \begin_layout Bibliography
3335 \begin_inset CommandInset bibitem
3336 LatexCommand bibitem
3343 \begin_inset CommandInset href
3345 name "Documentation"
3346 target "https://ctan.org/tex-archive/macros/latex/contrib/hyperref/doc/manual.pdf"
3351 of the \SpecialChar LaTeX
3357 \begin_layout Bibliography
3358 \begin_inset CommandInset bibitem
3359 LatexCommand bibitem
3366 \begin_inset CommandInset href
3368 name "Documentation"
3369 target "https://ctan.org/tex-archive/macros/latex/required/psnfss/psnfss2e.pdf"
3374 of the \SpecialChar LaTeX