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
86 \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
136 \notefontcolor #0000ff
143 \paragraph_separation indent
144 \paragraph_indentation default
146 \math_numbering_side default
147 \quotes_style english
151 \paperpagestyle default
153 \tracking_changes false
154 \output_changes false
156 \postpone_fragile_content false
159 \html_be_strict false
160 \docbook_table_output 0
161 \docbook_mathml_prefix 1
166 \begin_layout Begin PDF Form
167 \begin_inset Argument 1
170 \begin_layout Plain Layout
172 action=mailto:forms@lyx.test?subject=The submitted PDF form, method=post
181 Description of the module PDF Form
188 \begin_layout Standard
189 \begin_inset Note Note
192 \begin_layout Plain Layout
193 To export all parts of this document to PDF the \SpecialChar LaTeX
199 If it is not installed you can export the document anyway but the example
200 in the section about dynamic form elements will not appear in the output.
209 bundle available on CTAN.
210 As the name suggests, the style files of the bundle produce pdf files which
223 \begin_layout Standard
224 By loading the module PDF
228 Form the whole document or a part of it can be made a PDF form.
229 You can add all possible form elements like text fields buttons etc.
230 This document describes how this is done.
233 \begin_layout Section
235 \begin_inset CommandInset label
237 name "sec:Preparation"
244 \begin_layout Standard
245 At first load the module PDF
249 Form in the document settings of your file.
250 To make the whole document a form, insert the environment
262 from \SpecialChar LyX
263 's dropdown menu at the beginning of the document.
264 If only a part of the document should be a form, add
276 at the position where the form should start.
279 \begin_layout Standard
280 \begin_inset Note Greyedout
283 \begin_layout Plain Layout
288 It is only possible to have one form in a PDF file!
296 \begin_layout Standard
297 If the form data should be submitted to a server or the like, then you must
298 specify the URL as parameter of the
311 This is done by using the menu
313 Insert\SpecialChar menuseparator
325 For example in this document the following was inserted to the parameter
329 \begin_layout Standard
332 action=mailto:forms@lyx.test?subject=The submitted PDF form,
333 \begin_inset Newline newline
339 \begin_layout Standard
340 This sends the form data as email to
344 when the user presses the submit button.
345 The email subject will be
346 \begin_inset Quotes eld
349 The submitted PDF form
350 \begin_inset Quotes erd
353 and the submit method is
358 (The other possible method would be
362 .) For more about submitting see sec.
363 \begin_inset space \thinspace{}
367 \begin_inset CommandInset ref
369 reference "subsec:Submit-button"
376 \begin_layout Standard
377 \begin_inset Newpage newpage
383 \begin_layout Section
387 \begin_layout Standard
392 possible elements in a PDF form:
395 \begin_layout Subsection
399 \begin_layout Standard
400 A text field is added by inserting the custom inset
406 Insert\SpecialChar menuseparator
414 Write inside the inset the label for the text field that will be printed
415 in the PDF output before the field.
417 \begin_inset Newline newline
421 \begin_inset Flex TextField
424 \begin_layout Plain Layout
425 \begin_inset Argument 1
428 \begin_layout Plain Layout
434 Enter your name here:
442 \begin_layout Standard
443 You must also specify a name for text fields.
444 To do this set the cursor into its
448 inset and insert the parameter
459 \begin_layout Standard
460 Using the same name for several text fields results in an automatic duplication
461 of the inserted text.
462 This is for example useful if the user should input a date that should
463 appear at different places in the form.
464 \begin_inset Newline newline
471 fields as example: Fill one and see that the other one will be filled automatica
472 lly when you click outside of the field:
473 \begin_inset Newline newline
477 \begin_inset Flex TextField
480 \begin_layout Plain Layout
481 \begin_inset Argument 1
484 \begin_layout Plain Layout
496 \begin_inset Newline newline
500 \begin_inset Flex TextField
503 \begin_layout Plain Layout
504 \begin_inset Argument 1
507 \begin_layout Plain Layout
521 \begin_layout Standard
522 \begin_inset Note Greyedout
525 \begin_layout Plain Layout
530 Special characters should be avoided in element names.
538 \begin_layout Standard
539 All form fields can be customized by adding parameters.
542 \begin_layout Standard
543 Here is a customized multiline text field with a width of 60
544 \begin_inset space \thinspace{}
547 % of the text width, 3
548 \begin_inset space \thinspace{}
551 cm height and a proposed content:
552 \begin_inset VSpace defskip
556 \begin_inset Newline newline
560 \begin_inset Flex TextField
563 \begin_layout Plain Layout
564 \begin_inset Argument 1
567 \begin_layout Plain Layout
568 name=customer2, multiline, width=0.6
570 textwidth, height=3cm, value={proposed text}
575 Enter your name here:
583 \begin_layout Standard
584 \begin_inset Note Greyedout
587 \begin_layout Plain Layout
592 It is highly recommended to use a uniform layout of all fields in a form.
594 \begin_inset space \thinspace{}
598 \begin_inset CommandInset ref
600 reference "sec:Form-element-customization"
612 \begin_layout Subsection
616 \begin_layout Standard
617 A check box is added by inserting the custom inset
622 Write inside the inset the label for the box.
624 \begin_inset Newline newline
628 \begin_inset Flex CheckBox
631 \begin_layout Plain Layout
632 \begin_inset Argument 1
635 \begin_layout Plain Layout
641 Are you older than 18 years?
649 \begin_layout Standard
650 You must specify also for check boxes a name.
652 \begin_inset space \thinspace{}
656 \begin_inset space \space{}
667 is the name) into the
674 \begin_layout Subsection
678 \begin_layout Standard
679 A choice menu is added by inserting the custom inset
684 A label for the inset is added by using the menu
686 Insert\SpecialChar menuseparator
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 input something that is not in the predefined list.
707 \begin_layout Description
708 Popdown All choices are listed below each other.
709 If the menu is not high enough a scroll bar is automatically added.
712 \begin_layout Standard
713 To determine the choice menu type one uses the parameter
728 \begin_layout Standard
729 Here is an example for the radio type:
730 \begin_inset VSpace defskip
734 \begin_inset Newline newline
738 \begin_inset Flex ChoiceMenu
741 \begin_layout Plain Layout
742 \begin_inset Argument 1
745 \begin_layout Plain Layout
752 \begin_inset Argument 2
755 \begin_layout Plain Layout
769 \begin_layout Standard
770 Here is an example for the combo type:
771 \begin_inset VSpace defskip
775 \begin_inset Newline newline
779 \begin_inset Flex ChoiceMenu
782 \begin_layout Plain Layout
783 \begin_inset Argument 1
786 \begin_layout Plain Layout
792 Albania=Al, Armenia=Ar, Azerbaidschan=Az
793 \begin_inset Argument 2
796 \begin_layout Plain Layout
810 \begin_layout Standard
811 Here is an example for the popdown type:
812 \begin_inset VSpace defskip
816 \begin_inset Newline newline
820 \begin_inset Flex ChoiceMenu
823 \begin_layout Plain Layout
824 \begin_inset Argument 1
827 \begin_layout Plain Layout
828 popdown, name=country
833 Albania=Al, Armenia=Ar, Azerbaidschan=Az
834 \begin_inset Argument 2
837 \begin_layout Plain Layout
851 \begin_layout Standard
852 You must also specify a name for choice menus.
853 Insert for example the parameter
861 is the name) into the
868 \begin_layout Standard
869 It is recommended to add a short name for every choice to be able to access
870 them and to know which one was chosen by the user.
871 This is done by adding
875 behind each choice (where
880 For example the radio type example contains this choice list:
886 \begin_inset Quotes eld
890 \begin_inset Quotes erd
893 you know that he chose the choice
894 \begin_inset Quotes eld
898 \begin_inset Quotes erd
902 With the name you can also preset/propose e.g.
903 \begin_inset space \space{}
907 \begin_inset Quotes eld
911 \begin_inset Quotes erd
914 by adding the parameter
922 \begin_layout Standard
923 \begin_inset Flex ChoiceMenu
926 \begin_layout Plain Layout
927 \begin_inset Argument 1
930 \begin_layout Plain Layout
931 radio, name=sex, default=m
937 \begin_inset Argument 2
940 \begin_layout Plain Layout
954 \begin_layout Subsection
958 \begin_layout Standard
959 A push button is added by inserting the custom inset
964 Write inside the inset the label for the button.
968 \begin_layout Standard
969 \begin_inset Flex PushButton
972 \begin_layout Plain Layout
973 \begin_inset Argument 1
976 \begin_layout Plain Layout
982 Don't click on this button or your fridge will be destroyed!!!
990 \begin_layout Standard
991 The action that is triggered by pressing the button is specified by JavaScript
993 To do this, add the parameter
997 and insert the JavaScript code between the braces.
998 For info about JavaScript, see its documentation,
999 \begin_inset CommandInset citation
1007 In the following example this JavaScript code was used:
1008 \begin_inset Newline newline
1017 \begin_layout Plain Layout
1024 What the hell? Now you destroyed your fridge.
1026 \begin_inset Quotes eld
1030 \begin_inset Quotes erd
1037 \begin_layout Plain Layout
1047 \begin_layout Standard
1048 \begin_inset Flex PushButton
1051 \begin_layout Plain Layout
1052 \begin_inset Argument 1
1055 \begin_layout Plain Layout
1060 \begin_layout Plain Layout
1067 What the hell? Now you destroyed your fridge.
1069 \begin_inset Quotes eld
1073 \begin_inset Quotes erd
1080 \begin_layout Plain Layout
1092 Don't click on this button or your fridge will be destroyed!!!
1100 \begin_layout Standard
1101 \begin_inset Note Greyedout
1104 \begin_layout Plain Layout
1109 The outer quotes are part of the JavaScript code and must therefore be
1110 inserted as \SpecialChar TeX
1119 \begin_layout Standard
1120 A common usage for push buttons is to open a weblink.
1121 Such a button is created by inserting a hyperlink as button text.
1125 \begin_layout Standard
1126 \begin_inset Flex PushButton
1129 \begin_layout Plain Layout
1130 \begin_inset Argument 1
1133 \begin_layout Plain Layout
1140 \begin_inset CommandInset href
1142 name "Information how to fill out this form"
1143 target "https://wiki.lyx.org"
1156 \begin_layout Standard
1157 To get rid of the predefined frame for weblinks add this to the additional
1158 options in the document settings under
1161 \begin_inset space ~
1169 \begin_layout Standard
1172 urlbordercolor={1 0 0}
1175 \begin_layout Standard
1176 if your push button border color is red (the default), otherwise use the
1177 same color definition as for your push button border color.
1180 \begin_layout Subsection
1182 \begin_inset CommandInset label
1184 name "subsec:Submit-button"
1191 \begin_layout Standard
1192 A submit button is used to submit the form data to a server.
1193 It is added by inserting the custom inset
1198 The label for the button is written into the inset.
1202 \begin_layout Standard
1203 \begin_inset Flex SubmitButton
1206 \begin_layout Plain Layout
1207 \begin_inset Argument 1
1210 \begin_layout Plain Layout
1216 Send your data via email
1224 \begin_layout Standard
1225 The submit button creates a forms data format (FDF) file (file extension
1226 *.fdf) which is then submitted.
1227 The FDF file contains only the form data.
1228 They can later only be applied to a PDF form if all elements in the form
1232 \begin_layout Standard
1233 \begin_inset Note Greyedout
1236 \begin_layout Plain Layout
1241 You can only use a submit button if you specified the submit method and
1242 a target in the inset
1245 \begin_inset space ~
1249 \begin_inset space ~
1255 \begin_inset space \thinspace{}
1259 \begin_inset CommandInset ref
1261 reference "sec:Preparation"
1265 for the description.
1266 If there are no specifications you will get \SpecialChar LaTeX
1275 \begin_layout Subsection
1279 \begin_layout Standard
1280 A reset button is used to reset all form elements to the initial state.
1281 It is added by inserting the custom inset
1286 The label for the button is written into the inset.
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 Section
1313 Form element customization
1314 \begin_inset CommandInset label
1316 name "sec:Form-element-customization"
1323 \begin_layout Standard
1324 Since all form elements should look uniform, one can determine their layout
1325 using the following styles:
1328 \begin_layout Description
1330 \begin_inset space ~
1334 \begin_inset space ~
1340 \begin_layout Description
1342 \begin_inset space ~
1346 \begin_inset space ~
1352 \begin_layout Description
1354 \begin_inset space ~
1358 \begin_inset space ~
1361 Style affects all choice menu types
1364 \begin_layout Description
1366 \begin_inset space ~
1370 \begin_inset space ~
1373 Style affects only the combo box style
1376 \begin_layout Description
1378 \begin_inset space ~
1382 \begin_inset space ~
1385 Style affects only the popdown box style
1388 \begin_layout Description
1390 \begin_inset space ~
1394 \begin_inset space ~
1397 Style affects only the radio box style
1400 \begin_layout Description
1402 \begin_inset space ~
1406 \begin_inset space ~
1412 \begin_layout Description
1414 \begin_inset space ~
1418 \begin_inset space ~
1424 \begin_layout Description
1426 \begin_inset space ~
1430 \begin_inset space ~
1436 \begin_layout Standard
1437 The content of the styles is a comma-separated list of parameters.
1438 The possible parameters are listed in sec.
1439 \begin_inset space \thinspace{}
1443 \begin_inset Quotes eld
1446 Forms optional parameters
1447 \begin_inset Quotes erd
1450 of the documentation of the \SpecialChar LaTeX
1456 \begin_inset CommandInset citation
1464 It is important that the parameter
1468 is always part of the definition.
1469 Otherwise the elements will not appear in the PDF.
1470 The defined style is applied to all elements following the definition.
1473 \begin_layout Subsubsection*
1474 Here are some examples:
1477 \begin_layout Text Field Style
1478 print, bordercolor=red, borderstyle=U, backgroundcolor=lightgray, color=lime,
1479 maxlen=10, align=2, charsize=16pt
1480 \begin_inset Note Note
1483 \begin_layout Plain Layout
1516 \begin_layout Check Box Style
1517 print, borderstyle=S, checkboxsymbol=
1522 \begin_layout Combo Box Style
1523 print, bordercolor={0.33 0.66 0.33}, borderstyle=D
1526 \begin_layout Popdown Box Style
1528 \begin_inset Note Note
1531 \begin_layout Plain Layout
1536 determines the number of displayed menu entries.
1537 It does not work currently because of a bug in the \SpecialChar LaTeX
1550 \begin_layout Radio Box Style
1551 print, borderstyle=I, radiosymbol=3
1554 \begin_layout Push Button Style
1555 print, borderstyle=B, bordercolor=lime
1558 \begin_layout Submit Button Style
1559 print, borderwidth=0, bordercolor=white
1562 \begin_layout Reset Button Style
1563 print, bordercolor=lime
1566 \begin_layout Itemize
1567 Text field with gray background, lime text color, a red border only below
1568 the field, right alignment, 16
1569 \begin_inset space \thinspace{}
1572 pt font size and a limitation for maximal 10
1573 \begin_inset space ~
1576 characters to insert:
1577 \begin_inset VSpace defskip
1581 \begin_inset Newline newline
1585 \begin_inset Flex TextField
1588 \begin_layout Plain Layout
1589 \begin_inset Argument 1
1592 \begin_layout Plain Layout
1598 Enter your name here:
1606 \begin_layout Standard
1607 \begin_inset Note Greyedout
1610 \begin_layout Plain Layout
1623 custom background colors you must disable in these programs the highlighting
1626 \begin_inset Quotes eld
1629 Show border hover color for fields
1630 \begin_inset Quotes erd
1641 \begin_layout Itemize
1642 Check box with normal border and symbol
1645 \begin_inset VSpace defskip
1649 \begin_inset Newline newline
1653 \begin_inset Flex CheckBox
1656 \begin_layout Plain Layout
1657 \begin_inset Argument 1
1660 \begin_layout Plain Layout
1666 Are you older than 18 years?
1674 \begin_layout Standard
1675 The symbol is either specified as number or with the command
1676 \begin_inset Newline newline
1686 \begin_inset Newline newline
1693 is one of the possible numbers listed in Table
1694 \begin_inset space ~
1697 2 of the documentation of the \SpecialChar LaTeX
1703 \begin_inset CommandInset citation
1713 \begin_layout Itemize
1714 Combo choice menu with dashed, colored border where the last entry is preselecte
1716 \begin_inset VSpace defskip
1720 \begin_inset Newline newline
1724 \begin_inset Flex ChoiceMenu
1727 \begin_layout Plain Layout
1728 \begin_inset Argument 1
1731 \begin_layout Plain Layout
1732 combo, name=combo2, default=Az
1737 Albania=Al, Armenia=Ar, Azerbaidschan=Az
1738 \begin_inset Argument 2
1741 \begin_layout Plain Layout
1755 \begin_layout Itemize
1756 Popdown choice menu where the second entry is preselected:
1757 \begin_inset VSpace defskip
1761 \begin_inset Newline newline
1765 \begin_inset Flex ChoiceMenu
1768 \begin_layout Plain Layout
1769 \begin_inset Argument 1
1772 \begin_layout Plain Layout
1773 popdown, name=country2, default=Ar
1778 Albania=Al, Armenia=Ar, Azerbaidschan=Az
1779 \begin_inset Argument 2
1782 \begin_layout Plain Layout
1796 \begin_layout Standard
1797 \begin_inset VSpace defskip
1801 \begin_inset Note Greyedout
1804 \begin_layout Plain Layout
1821 have no effect for popdown choice menus.
1829 \begin_layout Itemize
1830 Radio choice menu with inverted bevel border and symbol number
1831 \begin_inset space ~
1835 \begin_inset VSpace defskip
1839 \begin_inset Newline newline
1843 \begin_inset Flex ChoiceMenu
1846 \begin_layout Plain Layout
1847 \begin_inset Argument 1
1850 \begin_layout Plain Layout
1857 \begin_inset Argument 2
1860 \begin_layout Plain Layout
1874 \begin_layout Standard
1875 \begin_inset VSpace defskip
1879 \begin_inset Note Greyedout
1882 \begin_layout Plain Layout
1903 have no effect for push, submit and reset buttons.
1911 \begin_layout Standard
1912 As workaround use a colored box and/or color the box text.
1915 \begin_layout Itemize
1916 Push button with a bevel border and colored text:
1917 \begin_inset VSpace defskip
1921 \begin_inset Newline newline
1925 \begin_inset Flex PushButton
1928 \begin_layout Plain Layout
1929 \begin_inset Argument 1
1932 \begin_layout Plain Layout
1937 \begin_layout Plain Layout
1944 Why do you click this?
1948 \begin_layout Plain Layout
1961 \begin_inset Box Frameless
1971 height_special "totalheight"
1976 backgroundcolor "lime"
1979 \begin_layout Plain Layout
1982 Don't click on this button!!!
1993 \begin_inset VSpace bigskip
1999 \begin_layout Itemize
2000 Submit button without border, with cyan background and increased height:
2001 \begin_inset VSpace defskip
2005 \begin_inset Newline newline
2009 \begin_inset Flex SubmitButton
2012 \begin_layout Plain Layout
2013 \begin_inset Argument 1
2016 \begin_layout Plain Layout
2023 \begin_inset Box Frameless
2033 height_special "totalheight"
2038 backgroundcolor "cyan"
2041 \begin_layout Plain Layout
2042 \begin_inset Box Frameless
2052 height_special "totalheight"
2057 backgroundcolor "none"
2060 \begin_layout Plain Layout
2061 Send your data via mail
2077 \begin_inset VSpace bigskip
2083 \begin_layout Itemize
2084 Reset button with a width of 7
2085 \begin_inset space \thinspace{}
2089 \begin_inset VSpace defskip
2093 \begin_inset Newline newline
2097 \begin_inset Flex ResetButton
2100 \begin_layout Plain Layout
2101 \begin_inset Argument 1
2104 \begin_layout Plain Layout
2111 \begin_inset Box Frameless
2121 height_special "totalheight"
2126 backgroundcolor "none"
2129 \begin_layout Plain Layout
2143 \begin_layout Standard
2144 \begin_inset Newpage newpage
2150 \begin_layout Section
2154 \begin_layout Standard
2155 One often needs basic actions to be done by the PDF viewer program, for
2156 example to print the form.
2157 Such PDF program-specific actions can be triggered by adding inserting
2171 can handle all possible actions while other PDF viewers might only support
2173 However, all PDF viewers support the basic things like printing, save
2174 \begin_inset space ~
2177 as, view in fullscreen etc..
2180 \begin_layout Standard
2181 To specify the action insert its name to the
2186 A list with possible action names can be found in sec.
2187 \begin_inset space \thinspace{}
2191 \begin_inset Quotes eld
2194 Acrobat-specific behavior
2195 \begin_inset Quotes erd
2198 of the documentation of the \SpecialChar LaTeX
2204 \begin_inset CommandInset citation
2214 \begin_layout Standard
2215 Here are some examples:
2218 \begin_layout Description
2220 \begin_inset Flex PDFAction
2223 \begin_layout Plain Layout
2224 \begin_inset Argument 1
2227 \begin_layout Plain Layout
2241 \begin_layout Description
2243 \begin_inset space ~
2247 \begin_inset Flex PDFAction
2250 \begin_layout Plain Layout
2251 \begin_inset Argument 1
2254 \begin_layout Plain Layout
2268 \begin_layout Description
2270 \begin_inset space ~
2274 \begin_inset space ~
2278 \begin_inset Flex PDFAction
2281 \begin_layout Plain Layout
2282 \begin_inset Argument 1
2285 \begin_layout Plain Layout
2291 View the form in fullscreen
2299 \begin_layout Subsection
2300 Action button customization
2301 \begin_inset CommandInset label
2303 name "subsec:Action-button-customization"
2310 \begin_layout Standard
2311 Customizing the action buttons requires the usage of boxes because things
2312 like the width, height and border separation cannot be specified as button
2316 \begin_layout Standard
2317 The easiest way to customize the buttons is to fill it with a custom box.
2318 For example the button should be 5
2319 \begin_inset space \thinspace{}
2322 cm wide and have the height of 2
2323 \begin_inset space ~
2327 Then create this parbox:
2330 \begin_layout Standard
2331 \begin_inset Box Frameless
2341 height_special "totalheight"
2346 backgroundcolor "none"
2349 \begin_layout Plain Layout
2359 \begin_layout Standard
2368 \begin_layout Standard
2369 \begin_inset Flex PDFAction
2372 \begin_layout Plain Layout
2373 \begin_inset Argument 1
2376 \begin_layout Plain Layout
2383 \begin_inset Box Frameless
2393 height_special "totalheight"
2398 backgroundcolor "none"
2401 \begin_layout Plain Layout
2415 \begin_layout PDF Link Setup
2417 \begin_inset Note Note
2420 \begin_layout Plain Layout
2421 Sets the thickness of the predefined link border to zero as described below.
2429 \begin_layout Standard
2430 To customize the border color, border thickness and the distance to the
2431 border one changes the border settings of the box.
2433 \begin_inset space \thinspace{}
2436 pt thick, teal border and 3
2437 \begin_inset space \thinspace{}
2440 pt border separation :
2441 \begin_inset VSpace defskip
2445 \begin_inset Newline newline
2449 \begin_inset Flex PDFAction
2452 \begin_layout Plain Layout
2453 \begin_inset Argument 1
2456 \begin_layout Plain Layout
2463 \begin_inset Box Boxed
2473 height_special "totalheight"
2478 backgroundcolor "white"
2481 \begin_layout Plain Layout
2496 \begin_layout Standard
2497 To customize the border thickness, add the command
2501 to the additional options in the document settings under
2504 \begin_inset space ~
2513 with a number that is the thickness in pixels.
2514 If you want to change the border thickness only for certain buttons, use
2518 \begin_inset space ~
2522 \begin_inset space ~
2527 before the button and insert there the command
2532 The default value of
2543 \begin_layout Standard
2544 \begin_inset Note Greyedout
2547 \begin_layout Plain Layout
2556 affects all link types, not only the action links.
2564 \begin_layout PDF Link Setup
2568 \begin_layout Standard
2570 \begin_inset space ~
2574 \begin_inset Newline newline
2578 \begin_inset Flex PDFAction
2581 \begin_layout Plain Layout
2582 \begin_inset Argument 1
2585 \begin_layout Plain Layout
2592 \begin_inset Box Frameless
2602 height_special "totalheight"
2607 backgroundcolor "none"
2610 \begin_layout Plain Layout
2625 \begin_layout Standard
2626 To change the border color use the command
2628 menubordercolor={r g b}
2642 are numbers between 0 and 1 for the colors red, green and blue.
2643 The default value of
2654 \begin_layout PDF Link Setup
2655 pdfborder={0 0 1}, menubordercolor={0.1 0.9 0.5}
2658 \begin_layout Standard
2661 menubordercolor={0.1 0.9 0.5}
2664 \begin_inset Newline newline
2668 \begin_inset Flex PDFAction
2671 \begin_layout Plain Layout
2672 \begin_inset Argument 1
2675 \begin_layout Plain Layout
2682 \begin_inset Box Frameless
2692 height_special "totalheight"
2697 backgroundcolor "none"
2700 \begin_layout Plain Layout
2715 \begin_layout Standard
2716 To change the background color use a colored box.
2719 \begin_layout PDF Link Setup
2723 \begin_layout Standard
2724 An example without a border and with lime background color:
2725 \begin_inset Newline newline
2729 \begin_inset Flex PDFAction
2732 \begin_layout Plain Layout
2733 \begin_inset Argument 1
2736 \begin_layout Plain Layout
2743 \begin_inset Box Frameless
2753 height_special "totalheight"
2758 backgroundcolor "lime"
2761 \begin_layout Plain Layout
2776 \begin_layout PDF Link Setup
2777 pdfborder={0 0 1}, menubordercolor={1 0 0}
2780 \begin_layout Section
2781 Dynamic form elements
2784 \begin_layout Standard
2785 It is also possible to have dynamic form elements.
2786 This means that depending on the actions of the user elements can (dis)appear
2787 or change their appearance.
2788 To use this feature, add these lines to your LaTeX preamble:
2791 \begin_layout Standard
2796 usepackage[pdftex]{insdljs}
2797 \begin_inset Newline newline
2811 \begin_layout Standard
2812 Then add the necessary JavaScript code to your document LaTeX preamble or
2814 code to your document.
2815 For info about JavaScript, see its documentation,
2816 \begin_inset CommandInset citation
2826 \begin_layout Standard
2830 \begin_layout Plain Layout
2840 \begin_inset Note Note
2843 \begin_layout Plain Layout
2844 The following section will only be displayed when the \SpecialChar LaTeX
2857 \begin_layout Standard
2858 For the following choice menu this JavaScript code was used:
2861 \begin_layout Standard
2862 \begin_inset listings
2863 lstparams "language=TeX"
2867 \begin_layout Plain Layout
2871 begin{insDLJS}[exaaae]{exaaae}{JavaScript}
2874 \begin_layout Plain Layout
2876 function validateTime(){
2879 \begin_layout Plain Layout
2884 \begin_layout Plain Layout
2886 if((event.value == "u") || (event.value == "unlimited")) {
2889 \begin_layout Plain Layout
2891 this.getField("from").display = display.hidden;
2894 \begin_layout Plain Layout
2896 this.getField("until").display = display.hidden;
2899 \begin_layout Plain Layout
2904 \begin_layout Plain Layout
2906 this.getField("from").display = display.visible;
2909 \begin_layout Plain Layout
2911 this.getField("until").display = display.visible;
2914 \begin_layout Plain Layout
2916 this.getField("from").setFocus();
2919 \begin_layout Plain Layout
2924 \begin_layout Plain Layout
2929 \begin_layout Plain Layout
2934 \begin_layout Plain Layout
2946 \begin_layout Standard
2947 \begin_inset Note Greyedout
2950 \begin_layout Plain Layout
2959 JavaScript functions must be inserted into the same
2971 \begin_layout Standard
2976 of the following choice menu are
2977 \begin_inset Newline newline
2982 name=contract,radio,default=tl,validate={validateTime();}
2985 \begin_layout Standard
2986 \begin_inset Flex ChoiceMenu
2989 \begin_layout Plain Layout
2990 \begin_inset Argument 1
2993 \begin_layout Plain Layout
2994 name=contract,radio,default=tl,validate={validateTime();}
2999 term-limited=tl, unlimited=u
3000 \begin_inset Argument 2
3003 \begin_layout Plain Layout
3015 \begin_inset VSpace defskip
3021 \begin_layout Standard
3022 \begin_inset Tabular
3023 <lyxtabular version="3" rows="3" columns="2">
3024 <features tabularvalignment="middle">
3025 <column alignment="left" valignment="top">
3026 <column alignment="center" valignment="top">
3028 <cell alignment="left" valignment="top" usebox="none">
3031 \begin_layout Plain Layout
3037 <cell alignment="center" valignment="top" usebox="none">
3040 \begin_layout Plain Layout
3041 \begin_inset Flex TextField
3044 \begin_layout Plain Layout
3045 \begin_inset Argument 1
3048 \begin_layout Plain Layout
3049 name=from,width=10em
3066 <cell alignment="center" valignment="top" usebox="none">
3069 \begin_layout Plain Layout
3075 <cell alignment="center" valignment="top" usebox="none">
3078 \begin_layout Plain Layout
3079 \begin_inset VSpace -1.5mm
3089 <cell alignment="left" valignment="top" usebox="none">
3092 \begin_layout Plain Layout
3098 <cell alignment="center" valignment="top" usebox="none">
3101 \begin_layout Plain Layout
3102 \begin_inset Flex TextField
3105 \begin_layout Plain Layout
3106 \begin_inset Argument 1
3109 \begin_layout Plain Layout
3110 name=until,width=10em
3133 \begin_layout Standard
3134 \begin_inset VSpace bigskip
3140 \begin_layout Standard
3141 To check and assure that the user only enters a number to a text field you
3142 can for example use this JavaScript code:
3145 \begin_layout Standard
3146 \begin_inset listings
3147 lstparams "language=TeX"
3151 \begin_layout Plain Layout
3153 function checkNumber() {
3156 \begin_layout Plain Layout
3161 \begin_layout Plain Layout
3163 if (!Number(event.value)) {
3166 \begin_layout Plain Layout
3168 app.alert("Value must be a number!");
3171 \begin_layout Plain Layout
3176 \begin_layout Plain Layout
3181 \begin_layout Plain Layout
3183 event.target.textColor = color.green;
3186 \begin_layout Plain Layout
3196 \begin_layout Standard
3197 An example text field:
3198 \begin_inset Flex TextField
3201 \begin_layout Plain Layout
3202 \begin_inset Argument 1
3205 \begin_layout Plain Layout
3206 name=onlyNumbers, align=1, validate={checkNumber();}
3219 \begin_layout Standard
3223 \begin_layout Plain Layout
3233 \begin_inset Note Note
3236 \begin_layout Plain Layout
3237 The following will be displayed when the \SpecialChar LaTeX
3250 \begin_layout Standard
3251 You need to install the package
3255 to see the content of this section in the output.
3258 \begin_layout Standard
3262 \begin_layout Plain Layout
3274 \begin_layout End PDF Form
3275 \begin_inset Note Note
3278 \begin_layout Plain Layout
3287 \begin_layout Section
3291 \begin_layout Itemize
3292 Submitting and applying data requires that all form elements have a name.
3295 \begin_layout Itemize
3296 Creating a PDF form requires pdf\SpecialChar TeX
3297 or Lua\SpecialChar TeX
3299 Use therefore either the \SpecialChar LyX
3311 \begin_layout Itemize
3320 custom background colors you must disable in these programs the highlighting
3323 \begin_inset Quotes eld
3326 Show border hover color for fields
3327 \begin_inset Quotes erd
3333 \begin_layout Bibliography
3334 \begin_inset CommandInset bibitem
3335 LatexCommand bibitem
3342 \begin_inset CommandInset href
3344 name "JavaScript reference"
3345 target "https://developer.mozilla.org/en/docs/Web/JavaScript/Reference"
3353 \begin_layout Bibliography
3354 \begin_inset CommandInset bibitem
3355 LatexCommand bibitem
3362 \begin_inset CommandInset href
3364 name "Documentation"
3365 target "https://ctan.org/tex-archive/macros/latex/contrib/hyperref/doc/manual.pdf"
3370 of the \SpecialChar LaTeX
3376 \begin_layout Bibliography
3377 \begin_inset CommandInset bibitem
3378 LatexCommand bibitem
3385 \begin_inset CommandInset href
3387 name "Documentation"
3388 target "https://ctan.org/tex-archive/macros/latex/required/psnfss/psnfss2e.pdf"
3393 of the \SpecialChar LaTeX