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,
182 Description of the module PDF Form
189 \begin_layout Standard
190 \begin_inset Note Note
193 \begin_layout Plain Layout
194 To export all parts of this document to PDF the \SpecialChar LaTeX
200 If it is not installed you can export the document anyway but the example in the section about dynamic form elements will not appear in the output.
209 bundle available on CTAN.
210 As the name suggests,
211 the style files of the bundle produce pdf files which will work correctly
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,
251 insert the environment
263 from \SpecialChar LyX
264 's dropdown menu at the beginning of the document.
265 If only a part of the document should be a form,
278 at the position where the form should start.
281 \begin_layout Standard
282 \begin_inset Note Greyedout
285 \begin_layout Plain Layout
291 It is only possible to have one form in a PDF file!
299 \begin_layout Standard
300 If the form data should be submitted to a server or the like,
301 then you must specify the URL as parameter of the
314 This is done by using the menu
316 Insert\SpecialChar menuseparator
328 For example in this document the following was inserted to the parameter inset:
331 \begin_layout Standard
334 action=mailto:forms@lyx.test?subject=The submitted PDF form,
335 \begin_inset Newline newline
341 \begin_layout Standard
342 This sends the form data as email to
346 when the user presses the submit button.
347 The email subject will be
348 \begin_inset Quotes eld
351 The submitted PDF form
352 \begin_inset Quotes erd
355 and the submit method is
360 (The other possible method would be
364 .) For more about submitting see sec.
365 \begin_inset space \thinspace{}
369 \begin_inset CommandInset ref
371 reference "subsec:Submit-button"
379 \begin_layout Standard
380 \begin_inset Newpage newpage
386 \begin_layout Section
390 \begin_layout Standard
395 possible elements in a PDF form:
398 \begin_layout Subsection
402 \begin_layout Standard
403 A text field is added by inserting the custom inset
409 Insert\SpecialChar menuseparator
417 Write inside the inset the label for the text field that will be printed in the PDF output before the field.
419 \begin_inset Newline newline
423 \begin_inset Flex TextField
426 \begin_layout Plain Layout
427 \begin_inset Argument 1
430 \begin_layout Plain Layout
436 Enter your name here:
444 \begin_layout Standard
445 You must also specify a name for text fields.
446 To do this set the cursor into its
450 inset and insert the parameter
461 \begin_layout Standard
462 Using the same name for several text fields results in an automatic duplication of the inserted text.
463 This is for example useful if the user should input a date that should appear at different places in the form.
464 \begin_inset Newline newline
472 Fill one and see that the other one will be filled automatically 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
531 Special characters should be avoided in element names.
539 \begin_layout Standard
540 All form fields can be customized by adding parameters.
543 \begin_layout Standard
544 Here is a customized multiline text field with a width of 60
545 \begin_inset space \thinspace{}
550 \begin_inset space \thinspace{}
553 cm height and a proposed content:
554 \begin_inset VSpace defskip
558 \begin_inset Newline newline
562 \begin_inset Flex TextField
565 \begin_layout Plain Layout
566 \begin_inset Argument 1
569 \begin_layout Plain Layout
576 value={proposed text}
581 Enter your name here:
589 \begin_layout Standard
590 \begin_inset Note Greyedout
593 \begin_layout Plain Layout
599 It is highly recommended to use a uniform layout of all fields in a form.
601 \begin_inset space \thinspace{}
605 \begin_inset CommandInset ref
607 reference "sec:Form-element-customization"
620 \begin_layout Subsection
624 \begin_layout Standard
625 A check box is added by inserting the custom inset
630 Write inside the inset the label for the box.
632 \begin_inset Newline newline
636 \begin_inset Flex CheckBox
639 \begin_layout Plain Layout
640 \begin_inset Argument 1
643 \begin_layout Plain Layout
649 Are you older than 18 years?
657 \begin_layout Standard
658 You must specify also for check boxes a name.
660 \begin_inset space \thinspace{}
664 \begin_inset space \space{}
675 is the name) into the
682 \begin_layout Subsection
686 \begin_layout Standard
687 A choice menu is added by inserting the custom inset
692 A label for the inset is added by using the menu
694 Insert\SpecialChar menuseparator
698 The different choices are inserted to the inset as comma-separated list.
706 \begin_layout Description
707 Radio Only one choice can be selected
710 \begin_layout Description
711 Combo The choices are listed in a combo box (dropdown list) but the user is allowed to input something that is not in the predefined list.
714 \begin_layout Description
715 Popdown All choices are listed below each other.
716 If the menu is not high enough a scroll bar is automatically added.
719 \begin_layout Standard
720 To determine the choice menu type one uses the parameter
736 \begin_layout Standard
737 Here is an example for the radio type:
738 \begin_inset VSpace defskip
742 \begin_inset Newline newline
746 \begin_inset Flex ChoiceMenu
749 \begin_layout Plain Layout
750 \begin_inset Argument 1
753 \begin_layout Plain Layout
762 \begin_inset Argument 2
765 \begin_layout Plain Layout
779 \begin_layout Standard
780 Here is an example for the combo type:
781 \begin_inset VSpace defskip
785 \begin_inset Newline newline
789 \begin_inset Flex ChoiceMenu
792 \begin_layout Plain Layout
793 \begin_inset Argument 1
796 \begin_layout Plain Layout
806 \begin_inset Argument 2
809 \begin_layout Plain Layout
823 \begin_layout Standard
824 Here is an example for the popdown type:
825 \begin_inset VSpace defskip
829 \begin_inset Newline newline
833 \begin_inset Flex ChoiceMenu
836 \begin_layout Plain Layout
837 \begin_inset Argument 1
840 \begin_layout Plain Layout
850 \begin_inset Argument 2
853 \begin_layout Plain Layout
867 \begin_layout Standard
868 You must also specify a name for choice menus.
869 Insert for example the parameter
877 is the name) into the
884 \begin_layout Standard
885 It is recommended to add a short name for every choice to be able to access them and to know which one was chosen by the user.
886 This is done by adding
890 behind each choice (where
895 For example the radio type example contains this choice list:
903 \begin_inset Quotes eld
907 \begin_inset Quotes erd
910 you know that he chose the choice
911 \begin_inset Quotes eld
915 \begin_inset Quotes erd
919 With the name you can also preset/propose e.g.
920 \begin_inset space \space{}
924 \begin_inset Quotes eld
928 \begin_inset Quotes erd
931 by adding the parameter
939 \begin_layout Standard
940 \begin_inset Flex ChoiceMenu
943 \begin_layout Plain Layout
944 \begin_inset Argument 1
947 \begin_layout Plain Layout
957 \begin_inset Argument 2
960 \begin_layout Plain Layout
974 \begin_layout Subsection
978 \begin_layout Standard
979 A push button is added by inserting the custom inset
984 Write inside the inset the label for the button.
988 \begin_layout Standard
989 \begin_inset Flex PushButton
992 \begin_layout Plain Layout
993 \begin_inset Argument 1
996 \begin_layout Plain Layout
1002 Don't click on this button or your fridge will be destroyed!!!
1010 \begin_layout Standard
1011 The action that is triggered by pressing the button is specified by JavaScript code.
1017 and insert the JavaScript code between the braces.
1018 For info about JavaScript,
1019 see its documentation,
1021 \begin_inset CommandInset citation
1029 In the following example this JavaScript code was used:
1030 \begin_inset Newline newline
1039 \begin_layout Plain Layout
1047 Now you destroyed your fridge.
1049 \begin_inset Quotes eld
1053 \begin_inset Quotes erd
1060 \begin_layout Plain Layout
1070 \begin_layout Standard
1071 \begin_inset Flex PushButton
1074 \begin_layout Plain Layout
1075 \begin_inset Argument 1
1078 \begin_layout Plain Layout
1083 \begin_layout Plain Layout
1091 Now you destroyed your fridge.
1093 \begin_inset Quotes eld
1097 \begin_inset Quotes erd
1104 \begin_layout Plain Layout
1116 Don't click on this button or your fridge will be destroyed!!!
1124 \begin_layout Standard
1125 \begin_inset Note Greyedout
1128 \begin_layout Plain Layout
1134 The outer quotes are part of the JavaScript code and must therefore be inserted as \SpecialChar TeX
1143 \begin_layout Standard
1144 A common usage for push buttons is to open a weblink.
1145 Such a button is created by inserting a hyperlink as button text.
1149 \begin_layout Standard
1150 \begin_inset Flex PushButton
1153 \begin_layout Plain Layout
1154 \begin_inset Argument 1
1157 \begin_layout Plain Layout
1164 \begin_inset CommandInset href
1166 name "Information how to fill out this form"
1167 target "https://wiki.lyx.org"
1180 \begin_layout Standard
1181 To get rid of the predefined frame for weblinks add this to the additional options in the document settings under
1184 \begin_inset space ~
1192 \begin_layout Standard
1195 urlbordercolor={1 0 0}
1198 \begin_layout Standard
1199 if your push button border color is red (the default),
1200 otherwise use the same color definition as for your push button border color.
1203 \begin_layout Subsection
1205 \begin_inset CommandInset label
1207 name "subsec:Submit-button"
1214 \begin_layout Standard
1215 A submit button is used to submit the form data to a server.
1216 It is added by inserting the custom inset
1221 The label for the button is written into the inset.
1225 \begin_layout Standard
1226 \begin_inset Flex SubmitButton
1229 \begin_layout Plain Layout
1230 \begin_inset Argument 1
1233 \begin_layout Plain Layout
1239 Send your data via email
1247 \begin_layout Standard
1248 The submit button creates a forms data format (FDF) file (file extension *.fdf) which is then submitted.
1249 The FDF file contains only the form data.
1250 They can later only be applied to a PDF form if all elements in the form have a name.
1253 \begin_layout Standard
1254 \begin_inset Note Greyedout
1257 \begin_layout Plain Layout
1263 You can only use a submit button if you specified the submit method and a target in the inset
1266 \begin_inset space ~
1270 \begin_inset space ~
1277 \begin_inset space \thinspace{}
1281 \begin_inset CommandInset ref
1283 reference "sec:Preparation"
1288 for the description.
1289 If there are no specifications you will get \SpecialChar LaTeX
1298 \begin_layout Subsection
1302 \begin_layout Standard
1303 A reset button is used to reset all form elements to the initial state.
1304 It is added by inserting the custom inset
1309 The label for the button is written into the inset.
1313 \begin_layout Standard
1314 \begin_inset Flex ResetButton
1317 \begin_layout Plain Layout
1318 \begin_inset Argument 1
1321 \begin_layout Plain Layout
1335 \begin_layout Section
1336 Form element customization
1337 \begin_inset CommandInset label
1339 name "sec:Form-element-customization"
1346 \begin_layout Standard
1347 Since all form elements should look uniform,
1348 one can determine their layout using the following styles:
1351 \begin_layout Description
1353 \begin_inset space ~
1357 \begin_inset space ~
1363 \begin_layout Description
1365 \begin_inset space ~
1369 \begin_inset space ~
1375 \begin_layout Description
1377 \begin_inset space ~
1381 \begin_inset space ~
1384 Style affects all choice menu types
1387 \begin_layout Description
1389 \begin_inset space ~
1393 \begin_inset space ~
1396 Style affects only the combo box style
1399 \begin_layout Description
1401 \begin_inset space ~
1405 \begin_inset space ~
1408 Style affects only the popdown box style
1411 \begin_layout Description
1413 \begin_inset space ~
1417 \begin_inset space ~
1420 Style affects only the radio box style
1423 \begin_layout Description
1425 \begin_inset space ~
1429 \begin_inset space ~
1435 \begin_layout Description
1437 \begin_inset space ~
1441 \begin_inset space ~
1447 \begin_layout Description
1449 \begin_inset space ~
1453 \begin_inset space ~
1459 \begin_layout Standard
1460 The content of the styles is a comma-separated list of parameters.
1461 The possible parameters are listed in sec.
1462 \begin_inset space \thinspace{}
1466 \begin_inset Quotes eld
1469 Forms optional parameters
1470 \begin_inset Quotes erd
1473 of the documentation of the \SpecialChar LaTeX
1480 \begin_inset CommandInset citation
1488 It is important that the parameter
1492 is always part of the definition.
1493 Otherwise the elements will not appear in the PDF.
1494 The defined style is applied to all elements following the definition.
1497 \begin_layout Subsubsection*
1498 Here are some examples:
1501 \begin_layout Text Field Style
1505 backgroundcolor=lightgray,
1510 \begin_inset Note Note
1513 \begin_layout Plain Layout
1549 \begin_layout Check Box Style
1557 \begin_layout Combo Box Style
1559 bordercolor={0.33 0.66 0.33},
1563 \begin_layout Popdown Box Style
1566 \begin_inset Note Note
1569 \begin_layout Plain Layout
1574 determines the number of displayed menu entries.
1575 It does not work currently because of a bug in the \SpecialChar LaTeX
1588 \begin_layout Radio Box Style
1594 \begin_layout Push Button Style
1600 \begin_layout Submit Button Style
1606 \begin_layout Reset Button Style
1611 \begin_layout Itemize
1612 Text field with gray background,
1614 a red border only below the field,
1617 \begin_inset space \thinspace{}
1620 pt font size and a limitation for maximal 10
1621 \begin_inset space ~
1624 characters to insert:
1625 \begin_inset VSpace defskip
1629 \begin_inset Newline newline
1633 \begin_inset Flex TextField
1636 \begin_layout Plain Layout
1637 \begin_inset Argument 1
1640 \begin_layout Plain Layout
1646 Enter your name here:
1654 \begin_layout Standard
1655 \begin_inset Note Greyedout
1658 \begin_layout Plain Layout
1672 custom background colors you must disable in these programs the highlighting of form fields.
1674 \begin_inset Quotes eld
1677 Show border hover color for fields
1678 \begin_inset Quotes erd
1689 \begin_layout Itemize
1690 Check box with normal border and symbol
1693 \begin_inset VSpace defskip
1697 \begin_inset Newline newline
1701 \begin_inset Flex CheckBox
1704 \begin_layout Plain Layout
1705 \begin_inset Argument 1
1708 \begin_layout Plain Layout
1714 Are you older than 18 years?
1722 \begin_layout Standard
1723 The symbol is either specified as number or with the command
1724 \begin_inset Newline newline
1734 \begin_inset Newline newline
1741 is one of the possible numbers listed in Table
1742 \begin_inset space ~
1745 2 of the documentation of the \SpecialChar LaTeX
1752 \begin_inset CommandInset citation
1762 \begin_layout Itemize
1763 Combo choice menu with dashed,
1764 colored border where the last entry is preselected:
1765 \begin_inset VSpace defskip
1769 \begin_inset Newline newline
1773 \begin_inset Flex ChoiceMenu
1776 \begin_layout Plain Layout
1777 \begin_inset Argument 1
1780 \begin_layout Plain Layout
1791 \begin_inset Argument 2
1794 \begin_layout Plain Layout
1808 \begin_layout Itemize
1809 Popdown choice menu where the second entry is preselected:
1810 \begin_inset VSpace defskip
1814 \begin_inset Newline newline
1818 \begin_inset Flex ChoiceMenu
1821 \begin_layout Plain Layout
1822 \begin_inset Argument 1
1825 \begin_layout Plain Layout
1836 \begin_inset Argument 2
1839 \begin_layout Plain Layout
1853 \begin_layout Standard
1854 \begin_inset VSpace defskip
1858 \begin_inset Note Greyedout
1861 \begin_layout Plain Layout
1879 have no effect for popdown choice menus.
1887 \begin_layout Itemize
1888 Radio choice menu with inverted bevel border and symbol number
1889 \begin_inset space ~
1893 \begin_inset VSpace defskip
1897 \begin_inset Newline newline
1901 \begin_inset Flex ChoiceMenu
1904 \begin_layout Plain Layout
1905 \begin_inset Argument 1
1908 \begin_layout Plain Layout
1917 \begin_inset Argument 2
1920 \begin_layout Plain Layout
1934 \begin_layout Standard
1935 \begin_inset VSpace defskip
1939 \begin_inset Note Greyedout
1942 \begin_layout Plain Layout
1966 have no effect for push,
1967 submit and reset buttons.
1975 \begin_layout Standard
1976 As workaround use a colored box and/or color the box text.
1979 \begin_layout Itemize
1980 Push button with a bevel border and colored text:
1981 \begin_inset VSpace defskip
1985 \begin_inset Newline newline
1989 \begin_inset Flex PushButton
1992 \begin_layout Plain Layout
1993 \begin_inset Argument 1
1996 \begin_layout Plain Layout
2001 \begin_layout Plain Layout
2008 Why do you click this?
2012 \begin_layout Plain Layout
2025 \begin_inset Box Frameless
2035 height_special "totalheight"
2040 backgroundcolor "lime"
2043 \begin_layout Plain Layout
2046 Don't click on this button!!!
2057 \begin_inset VSpace bigskip
2063 \begin_layout Itemize
2064 Submit button without border,
2065 with cyan background and increased height:
2066 \begin_inset VSpace defskip
2070 \begin_inset Newline newline
2074 \begin_inset Flex SubmitButton
2077 \begin_layout Plain Layout
2078 \begin_inset Argument 1
2081 \begin_layout Plain Layout
2088 \begin_inset Box Frameless
2098 height_special "totalheight"
2103 backgroundcolor "cyan"
2106 \begin_layout Plain Layout
2107 \begin_inset Box Frameless
2117 height_special "totalheight"
2122 backgroundcolor "none"
2125 \begin_layout Plain Layout
2126 Send your data via mail
2142 \begin_inset VSpace bigskip
2148 \begin_layout Itemize
2149 Reset button with a width of 7
2150 \begin_inset space \thinspace{}
2154 \begin_inset VSpace defskip
2158 \begin_inset Newline newline
2162 \begin_inset Flex ResetButton
2165 \begin_layout Plain Layout
2166 \begin_inset Argument 1
2169 \begin_layout Plain Layout
2176 \begin_inset Box Frameless
2186 height_special "totalheight"
2191 backgroundcolor "none"
2194 \begin_layout Plain Layout
2208 \begin_layout Standard
2209 \begin_inset Newpage newpage
2215 \begin_layout Section
2219 \begin_layout Standard
2220 One often needs basic actions to be done by the PDF viewer program,
2221 for example to print the form.
2222 Such PDF program-specific actions can be triggered by adding inserting the custom inset
2235 can handle all possible actions while other PDF viewers might only support some of them.
2237 all PDF viewers support the basic things like printing,
2239 \begin_inset space ~
2243 view in fullscreen etc..
2246 \begin_layout Standard
2247 To specify the action insert its name to the
2252 A list with possible action names can be found in sec.
2253 \begin_inset space \thinspace{}
2257 \begin_inset Quotes eld
2260 Acrobat-specific behavior
2261 \begin_inset Quotes erd
2264 of the documentation of the \SpecialChar LaTeX
2271 \begin_inset CommandInset citation
2281 \begin_layout Standard
2282 Here are some examples:
2285 \begin_layout Description
2288 \begin_inset Flex PDFAction
2291 \begin_layout Plain Layout
2292 \begin_inset Argument 1
2295 \begin_layout Plain Layout
2309 \begin_layout Description
2311 \begin_inset space ~
2316 \begin_inset Flex PDFAction
2319 \begin_layout Plain Layout
2320 \begin_inset Argument 1
2323 \begin_layout Plain Layout
2337 \begin_layout Description
2339 \begin_inset space ~
2343 \begin_inset space ~
2348 \begin_inset Flex PDFAction
2351 \begin_layout Plain Layout
2352 \begin_inset Argument 1
2355 \begin_layout Plain Layout
2361 View the form in fullscreen
2369 \begin_layout Subsection
2370 Action button customization
2371 \begin_inset CommandInset label
2373 name "subsec:Action-button-customization"
2380 \begin_layout Standard
2381 Customizing the action buttons requires the usage of boxes because things like the width,
2382 height and border separation cannot be specified as button parameters.
2385 \begin_layout Standard
2386 The easiest way to customize the buttons is to fill it with a custom box.
2387 For example the button should be 5
2388 \begin_inset space \thinspace{}
2391 cm wide and have the height of 2
2392 \begin_inset space ~
2396 Then create this parbox:
2399 \begin_layout Standard
2400 \begin_inset Box Frameless
2410 height_special "totalheight"
2415 backgroundcolor "none"
2418 \begin_layout Plain Layout
2428 \begin_layout Standard
2437 \begin_layout Standard
2438 \begin_inset Flex PDFAction
2441 \begin_layout Plain Layout
2442 \begin_inset Argument 1
2445 \begin_layout Plain Layout
2452 \begin_inset Box Frameless
2462 height_special "totalheight"
2467 backgroundcolor "none"
2470 \begin_layout Plain Layout
2484 \begin_layout PDF Link Setup
2486 \begin_inset Note Note
2489 \begin_layout Plain Layout
2490 Sets the thickness of the predefined link border to zero as described below.
2498 \begin_layout Standard
2499 To customize the border color,
2500 border thickness and the distance to the border one changes the border settings of the box.
2502 \begin_inset space \thinspace{}
2507 \begin_inset space \thinspace{}
2510 pt border separation :
2511 \begin_inset VSpace defskip
2515 \begin_inset Newline newline
2519 \begin_inset Flex PDFAction
2522 \begin_layout Plain Layout
2523 \begin_inset Argument 1
2526 \begin_layout Plain Layout
2533 \begin_inset Box Boxed
2543 height_special "totalheight"
2548 backgroundcolor "white"
2551 \begin_layout Plain Layout
2566 \begin_layout Standard
2567 To customize the border thickness,
2572 to the additional options in the document settings under
2575 \begin_inset space ~
2584 with a number that is the thickness in pixels.
2585 If you want to change the border thickness only for certain buttons,
2589 \begin_inset space ~
2593 \begin_inset space ~
2598 before the button and insert there the command
2603 The default value of
2614 \begin_layout Standard
2615 \begin_inset Note Greyedout
2618 \begin_layout Plain Layout
2628 affects all link types,
2629 not only the action links.
2637 \begin_layout PDF Link Setup
2641 \begin_layout Standard
2643 \begin_inset space ~
2647 \begin_inset Newline newline
2651 \begin_inset Flex PDFAction
2654 \begin_layout Plain Layout
2655 \begin_inset Argument 1
2658 \begin_layout Plain Layout
2665 \begin_inset Box Frameless
2675 height_special "totalheight"
2680 backgroundcolor "none"
2683 \begin_layout Plain Layout
2698 \begin_layout Standard
2699 To change the border color use the command
2701 menubordercolor={r g b}
2716 are numbers between 0 and 1 for the colors red,
2718 The default value of
2729 \begin_layout PDF Link Setup
2731 menubordercolor={0.1 0.9 0.5}
2734 \begin_layout Standard
2737 menubordercolor={0.1 0.9 0.5}
2740 \begin_inset Newline newline
2744 \begin_inset Flex PDFAction
2747 \begin_layout Plain Layout
2748 \begin_inset Argument 1
2751 \begin_layout Plain Layout
2758 \begin_inset Box Frameless
2768 height_special "totalheight"
2773 backgroundcolor "none"
2776 \begin_layout Plain Layout
2791 \begin_layout Standard
2792 To change the background color use a colored box.
2795 \begin_layout PDF Link Setup
2799 \begin_layout Standard
2800 An example without a border and with lime background color:
2801 \begin_inset Newline newline
2805 \begin_inset Flex PDFAction
2808 \begin_layout Plain Layout
2809 \begin_inset Argument 1
2812 \begin_layout Plain Layout
2819 \begin_inset Box Frameless
2829 height_special "totalheight"
2834 backgroundcolor "lime"
2837 \begin_layout Plain Layout
2852 \begin_layout PDF Link Setup
2854 menubordercolor={1 0 0}
2857 \begin_layout Section
2858 Dynamic form elements
2861 \begin_layout Standard
2862 It is also possible to have dynamic form elements.
2863 This means that depending on the actions of the user elements can (dis)appear or change their appearance.
2864 To use this feature,
2865 add these lines to your LaTeX preamble:
2868 \begin_layout Standard
2873 usepackage[pdftex]{insdljs}
2874 \begin_inset Newline newline
2888 \begin_layout Standard
2889 Then add the necessary JavaScript code to your document LaTeX preamble or as \SpecialChar TeX
2890 code to your document.
2891 For info about JavaScript,
2892 see its documentation,
2894 \begin_inset CommandInset citation
2904 \begin_layout Standard
2908 \begin_layout Plain Layout
2918 \begin_inset Note Note
2921 \begin_layout Plain Layout
2922 The following section will only be displayed when the \SpecialChar LaTeX
2935 \begin_layout Standard
2936 For the following choice menu this JavaScript code was used:
2939 \begin_layout Standard
2940 \begin_inset listings
2941 lstparams "language=TeX"
2945 \begin_layout Plain Layout
2949 begin{insDLJS}[exaaae]{exaaae}{JavaScript}
2952 \begin_layout Plain Layout
2954 function validateTime(){
2957 \begin_layout Plain Layout
2962 \begin_layout Plain Layout
2964 if((event.value == "u") || (event.value == "unlimited")) {
2967 \begin_layout Plain Layout
2969 this.getField("from").display = display.hidden;
2972 \begin_layout Plain Layout
2974 this.getField("until").display = display.hidden;
2977 \begin_layout Plain Layout
2982 \begin_layout Plain Layout
2984 this.getField("from").display = display.visible;
2987 \begin_layout Plain Layout
2989 this.getField("until").display = display.visible;
2992 \begin_layout Plain Layout
2994 this.getField("from").setFocus();
2997 \begin_layout Plain Layout
3002 \begin_layout Plain Layout
3007 \begin_layout Plain Layout
3012 \begin_layout Plain Layout
3024 \begin_layout Standard
3025 \begin_inset Note Greyedout
3028 \begin_layout Plain Layout
3038 JavaScript functions must be inserted into the same
3050 \begin_layout Standard
3055 of the following choice menu are
3056 \begin_inset Newline newline
3061 name=contract,radio,default=tl,validate={validateTime();}
3064 \begin_layout Standard
3065 \begin_inset Flex ChoiceMenu
3068 \begin_layout Plain Layout
3069 \begin_inset Argument 1
3072 \begin_layout Plain Layout
3073 name=contract,radio,default=tl,validate={validateTime();}
3080 \begin_inset Argument 2
3083 \begin_layout Plain Layout
3095 \begin_inset VSpace defskip
3101 \begin_layout Standard
3102 \begin_inset Tabular
3103 <lyxtabular version="3" rows="3" columns="2">
3104 <features tabularvalignment="middle">
3105 <column alignment="left" valignment="top">
3106 <column alignment="center" valignment="top">
3108 <cell alignment="left" valignment="top" usebox="none">
3111 \begin_layout Plain Layout
3117 <cell alignment="center" valignment="top" usebox="none">
3120 \begin_layout Plain Layout
3121 \begin_inset Flex TextField
3124 \begin_layout Plain Layout
3125 \begin_inset Argument 1
3128 \begin_layout Plain Layout
3129 name=from,width=10em
3146 <cell alignment="center" valignment="top" usebox="none">
3149 \begin_layout Plain Layout
3155 <cell alignment="center" valignment="top" usebox="none">
3158 \begin_layout Plain Layout
3159 \begin_inset VSpace -1.5mm
3169 <cell alignment="left" valignment="top" usebox="none">
3172 \begin_layout Plain Layout
3178 <cell alignment="center" valignment="top" usebox="none">
3181 \begin_layout Plain Layout
3182 \begin_inset Flex TextField
3185 \begin_layout Plain Layout
3186 \begin_inset Argument 1
3189 \begin_layout Plain Layout
3190 name=until,width=10em
3213 \begin_layout Standard
3214 \begin_inset VSpace bigskip
3220 \begin_layout Standard
3221 To check and assure that the user only enters a number to a text field you can for example use this JavaScript code:
3224 \begin_layout Standard
3225 \begin_inset listings
3226 lstparams "language=TeX"
3230 \begin_layout Plain Layout
3232 function checkNumber() {
3235 \begin_layout Plain Layout
3240 \begin_layout Plain Layout
3242 if (!Number(event.value)) {
3245 \begin_layout Plain Layout
3247 app.alert("Value must be a number!");
3250 \begin_layout Plain Layout
3255 \begin_layout Plain Layout
3260 \begin_layout Plain Layout
3262 event.target.textColor = color.green;
3265 \begin_layout Plain Layout
3275 \begin_layout Standard
3276 An example text field:
3278 \begin_inset Flex TextField
3281 \begin_layout Plain Layout
3282 \begin_inset Argument 1
3285 \begin_layout Plain Layout
3288 validate={checkNumber();}
3301 \begin_layout Standard
3305 \begin_layout Plain Layout
3315 \begin_inset Note Note
3318 \begin_layout Plain Layout
3319 The following will be displayed when the \SpecialChar LaTeX
3332 \begin_layout Standard
3333 You need to install the package
3337 to see the content of this section in the output.
3340 \begin_layout Standard
3344 \begin_layout Plain Layout
3356 \begin_layout End PDF Form
3357 \begin_inset Note Note
3360 \begin_layout Plain Layout
3369 \begin_layout Section
3373 \begin_layout Itemize
3374 Submitting and applying data requires that all form elements have a name.
3377 \begin_layout Itemize
3378 Creating a PDF form requires pdf\SpecialChar TeX
3379 or Lua\SpecialChar TeX
3381 Use therefore either the \SpecialChar LyX
3393 \begin_layout Itemize
3402 custom background colors you must disable in these programs the highlighting of form fields.
3404 \begin_inset Quotes eld
3407 Show border hover color for fields
3408 \begin_inset Quotes erd
3414 \begin_layout Bibliography
3415 \begin_inset CommandInset bibitem
3416 LatexCommand bibitem
3423 \begin_inset CommandInset href
3425 name "JavaScript reference"
3426 target "https://developer.mozilla.org/en/docs/Web/JavaScript/Reference"
3434 \begin_layout Bibliography
3435 \begin_inset CommandInset bibitem
3436 LatexCommand bibitem
3443 \begin_inset CommandInset href
3445 name "Documentation"
3446 target "https://ctan.org/tex-archive/macros/latex/contrib/hyperref/doc/manual.pdf"
3451 of the \SpecialChar LaTeX
3457 \begin_layout Bibliography
3458 \begin_inset CommandInset bibitem
3459 LatexCommand bibitem
3466 \begin_inset CommandInset href
3468 name "Documentation"
3469 target "https://ctan.org/tex-archive/macros/latex/required/psnfss/psnfss2e.pdf"
3474 of the \SpecialChar LaTeX