]> git.lyx.org Git - lyx.git/blob - lib/examples/Modules/PDF_Form.lyx
DocBook: start implementing LilyPond.
[lyx.git] / lib / examples / Modules / PDF_Form.lyx
1 #LyX 2.4 created this file. For more info see https://www.lyx.org/
2 \lyxformat 608
3 \begin_document
4 \begin_header
5 \save_transient_properties true
6 \origin /systemlyxdir/examples/Modules/
7 \textclass scrartcl
8 \begin_preamble
9 % used to check for needed LaTeX packages
10 \usepackage{ifthen}
11
12 % check for package insdljs
13 % used for JavScript code
14 \newboolean{insdljs}
15 \IfFileExists{insdljs.sty}
16  {\usepackage[pdftex]{insdljs}
17   \setboolean{insdljs}{true}
18   \pdfcatalog{/AA \the\pdflastobj\space 0 R}}
19  {\setboolean{insdljs}{false}}
20
21 \ifinsdljs % only execute if package insdljs is installed
22
23  \begin{insDLJS}[exaaae]{exaaae}{JavaScript}
24
25   function validateTime(){
26    this.delay = true;
27    if((event.value == "u") || (event.value == "unlimited")) {
28     this.getField("from").display = display.hidden;
29     this.getField("until").display = display.hidden;
30    } else {
31     this.getField("from").display = display.visible;
32     this.getField("until").display = display.visible;
33     this.getField("from").setFocus();
34    }
35    this.delay = false;
36   }
37  
38  function checkNumber() {
39   event.rc = true;
40   if (!Number(event.value))
41   {
42    app.alert("Value must be a number!");
43    event.value = "";
44   }  else {
45    event.target.textColor = color.green;
46  }
47
48 }
49
50  \end{insDLJS}
51
52 \fi % end \ifinsdljs
53
54 % if pdflatex is used
55 \usepackage{ifpdf}
56 \ifpdf
57
58 % set fonts for nicer pdf view
59 \IfFileExists{lmodern.sty}
60  {\usepackage{lmodern}}{}
61
62 \fi % end if pdflatex is used
63 % Added by lyx2lyx
64 \setlength{\parskip}{\medskipamount}
65 \setlength{\parindent}{0pt}
66 \end_preamble
67 \options BCOR8mm,pagesize
68 \use_default_options false
69 \begin_modules
70 pdfform
71 \end_modules
72 \maintain_unincluded_children no
73 \language english
74 \language_package default
75 \inputencoding utf8
76 \fontencoding auto
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
83 \font_sc false
84 \font_roman_osf false
85 \font_sans_osf false
86 \font_typewriter_osf false
87 \font_sf_scale 100 100
88 \font_tt_scale 100 100
89 \use_microtype false
90 \use_dash_ligatures false
91 \graphics default
92 \default_output_format pdf2
93 \output_sync 0
94 \bibtex_command bibtex
95 \index_command default
96 \paperfontsize 12
97 \spacing single
98 \use_hyperref true
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"
103 \pdf_bookmarks true
104 \pdf_bookmarksnumbered true
105 \pdf_bookmarksopen true
106 \pdf_bookmarksopenlevel 2
107 \pdf_breaklinks false
108 \pdf_pdfborder false
109 \pdf_colorlinks false
110 \pdf_backref false
111 \pdf_pdfusetitle false
112 \pdf_quoted_options "pdfpagelayout=OneColumn, pdfnewwindow=true, pdfstartview=XYZ, plainpages=false, urlbordercolor={1 0 0}"
113 \papersize a4
114 \use_geometry false
115 \use_package amsmath 1
116 \use_package amssymb 1
117 \use_package cancel 1
118 \use_package esint 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
125 \cite_engine basic
126 \cite_engine_type default
127 \biblio_style plain
128 \use_bibtopic false
129 \use_indices false
130 \paperorientation portrait
131 \suppress_date true
132 \justification true
133 \use_refstyle 0
134 \use_minted 0
135 \use_lineno 0
136 \notefontcolor #0000ff
137 \index Index
138 \shortcut idx
139 \color #008000
140 \end_index
141 \secnumdepth 3
142 \tocdepth 2
143 \paragraph_separation indent
144 \paragraph_indentation default
145 \is_math_indent 0
146 \math_numbering_side default
147 \quotes_style english
148 \dynamic_quotes 0
149 \papercolumns 1
150 \papersides 1
151 \paperpagestyle default
152 \tablestyle default
153 \tracking_changes false
154 \output_changes false
155 \change_bars false
156 \postpone_fragile_content false
157 \html_math_output 0
158 \html_css_as_file 0
159 \html_be_strict false
160 \docbook_table_output 0
161 \docbook_mathml_prefix 1
162 \end_header
163
164 \begin_body
165
166 \begin_layout Begin PDF Form
167 \begin_inset Argument 1
168 status open
169
170 \begin_layout Plain Layout
171
172 action=mailto:forms@lyx.test?subject=The submitted PDF form, method=post
173 \end_layout
174
175 \end_inset
176
177
178 \end_layout
179
180 \begin_layout Title
181 Description of the module PDF Form
182 \end_layout
183
184 \begin_layout Author
185 Uwe Stöhr
186 \end_layout
187
188 \begin_layout Standard
189 \begin_inset Note Note
190 status collapsed
191
192 \begin_layout Plain Layout
193 To export all parts of this document to PDF the \SpecialChar LaTeX
194 -package 
195 \series bold
196 insdljs
197 \series default
198  must be installed.
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.
201
202 \series bold
203  insdljs.sty 
204 \series default
205 is part of the 
206 \series bold
207 acrotex
208 \series default
209  bundle available on CTAN.
210  As the name suggests, the style files of the bundle produce pdf files which
211  will work correctly 
212 \emph on
213 only
214 \emph default
215  with Acrobat DC.
216 \end_layout
217
218 \end_inset
219
220
221 \end_layout
222
223 \begin_layout Standard
224 By loading the module PDF
225 \begin_inset space ~
226 \end_inset
227
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.
231 \end_layout
232
233 \begin_layout Section
234 Preparation
235 \begin_inset CommandInset label
236 LatexCommand label
237 name "sec:Preparation"
238
239 \end_inset
240
241
242 \end_layout
243
244 \begin_layout Standard
245 At first load the module PDF
246 \begin_inset space ~
247 \end_inset
248
249 Form in the document settings of your file.
250  To make the whole document a form, insert the environment
251 \family sans
252  Begin
253 \begin_inset space ~
254 \end_inset
255
256 PDF
257 \begin_inset space ~
258 \end_inset
259
260 Form
261 \family default
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 
265 \family sans
266 Begin
267 \begin_inset space ~
268 \end_inset
269
270 PDF
271 \begin_inset space ~
272 \end_inset
273
274 Form
275 \family default
276  at the position where the form should start.
277 \end_layout
278
279 \begin_layout Standard
280 \begin_inset Note Greyedout
281 status open
282
283 \begin_layout Plain Layout
284
285 \series bold
286 Note:
287 \series default
288  It is only possible to have one form in a PDF file!
289 \end_layout
290
291 \end_inset
292
293
294 \end_layout
295
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 
299 \family sans
300 Begin
301 \begin_inset space ~
302 \end_inset
303
304 PDF
305 \begin_inset space ~
306 \end_inset
307
308 Form
309 \family default
310  environment.
311  This is done by using the menu 
312 \family sans
313 Insert\SpecialChar menuseparator
314 PDF
315 \begin_inset space ~
316 \end_inset
317
318 Form
319 \begin_inset space ~
320 \end_inset
321
322 Parameters
323 \family default
324 .
325  For example in this document the following was inserted to the parameter
326  inset:
327 \end_layout
328
329 \begin_layout Standard
330
331 \series bold
332 action=mailto:forms@lyx.test?subject=The submitted PDF form,
333 \begin_inset Newline newline
334 \end_inset
335
336 method=post
337 \end_layout
338
339 \begin_layout Standard
340 This sends the form data as email to 
341 \emph on
342 forms@lyx.test
343 \emph default
344  when the user presses the submit button.
345  The email subject will be 
346 \begin_inset Quotes eld
347 \end_inset
348
349 The submitted PDF form
350 \begin_inset Quotes erd
351 \end_inset
352
353  and the submit method is 
354 \series bold
355 post
356 \series default
357 .
358  (The other possible method would be 
359 \series bold
360 get
361 \series default
362 .) For more about submitting see sec.
363 \begin_inset space \thinspace{}
364 \end_inset
365
366
367 \begin_inset CommandInset ref
368 LatexCommand ref
369 reference "subsec:Submit-button"
370
371 \end_inset
372
373 .
374 \end_layout
375
376 \begin_layout Standard
377 \begin_inset Newpage newpage
378 \end_inset
379
380
381 \end_layout
382
383 \begin_layout Section
384 Form elements
385 \end_layout
386
387 \begin_layout Standard
388 There are 6
389 \begin_inset space ~
390 \end_inset
391
392 possible elements in a PDF form:
393 \end_layout
394
395 \begin_layout Subsection
396 Text field
397 \end_layout
398
399 \begin_layout Standard
400 A text field is added by inserting the custom inset 
401 \family sans
402 TextField
403 \family default
404  using the menu 
405 \family sans
406 Insert\SpecialChar menuseparator
407 Custom
408 \begin_inset space ~
409 \end_inset
410
411 Insets
412 \family default
413 .
414  Write inside the inset the label for the text field that will be printed
415  in the PDF output before the field.
416  Here is an example:
417 \begin_inset Newline newline
418 \end_inset
419
420
421 \begin_inset Flex TextField
422 status open
423
424 \begin_layout Plain Layout
425 \begin_inset Argument 1
426 status open
427
428 \begin_layout Plain Layout
429 name=customer
430 \end_layout
431
432 \end_inset
433
434 Enter your name here:
435 \end_layout
436
437 \end_inset
438
439
440 \end_layout
441
442 \begin_layout Standard
443 You must also specify a name for text fields.
444  To do this set the cursor into its 
445 \family sans
446 Params
447 \family default
448  inset and insert the parameter 
449 \series bold
450 name=customer
451 \series default
452  (where 
453 \series bold
454 customer
455 \series default
456  is the field name).
457 \end_layout
458
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
465 \end_inset
466
467 Here are 2
468 \begin_inset space ~
469 \end_inset
470
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
474 \end_inset
475
476
477 \begin_inset Flex TextField
478 status open
479
480 \begin_layout Plain Layout
481 \begin_inset Argument 1
482 status open
483
484 \begin_layout Plain Layout
485 name=identic
486 \end_layout
487
488 \end_inset
489
490
491 \end_layout
492
493 \end_inset
494
495
496 \begin_inset Newline newline
497 \end_inset
498
499
500 \begin_inset Flex TextField
501 status open
502
503 \begin_layout Plain Layout
504 \begin_inset Argument 1
505 status open
506
507 \begin_layout Plain Layout
508 name=identic
509 \end_layout
510
511 \end_inset
512
513
514 \end_layout
515
516 \end_inset
517
518
519 \end_layout
520
521 \begin_layout Standard
522 \begin_inset Note Greyedout
523 status open
524
525 \begin_layout Plain Layout
526
527 \series bold
528 Note:
529 \series default
530  Special characters should be avoided in element names.
531 \end_layout
532
533 \end_inset
534
535
536 \end_layout
537
538 \begin_layout Standard
539 All form fields can be customized by adding parameters.
540 \end_layout
541
542 \begin_layout Standard
543 Here is a customized multiline text field with a width of 60
544 \begin_inset space \thinspace{}
545 \end_inset
546
547 % of the text width, 3
548 \begin_inset space \thinspace{}
549 \end_inset
550
551 cm height and a proposed content:
552 \begin_inset VSpace defskip
553 \end_inset
554
555
556 \begin_inset Newline newline
557 \end_inset
558
559
560 \begin_inset Flex TextField
561 status open
562
563 \begin_layout Plain Layout
564 \begin_inset Argument 1
565 status open
566
567 \begin_layout Plain Layout
568 name=customer2, multiline, width=0.6
569 \backslash
570 textwidth, height=3cm, value={proposed text}
571 \end_layout
572
573 \end_inset
574
575 Enter your name here:
576 \end_layout
577
578 \end_inset
579
580
581 \end_layout
582
583 \begin_layout Standard
584 \begin_inset Note Greyedout
585 status open
586
587 \begin_layout Plain Layout
588
589 \series bold
590 Note:
591 \series default
592  It is highly recommended to use a uniform layout of all fields in a form.
593  See sec.
594 \begin_inset space \thinspace{}
595 \end_inset
596
597
598 \begin_inset CommandInset ref
599 LatexCommand ref
600 reference "sec:Form-element-customization"
601
602 \end_inset
603
604  how this is done.
605 \end_layout
606
607 \end_inset
608
609
610 \end_layout
611
612 \begin_layout Subsection
613 Check box
614 \end_layout
615
616 \begin_layout Standard
617 A check box is added by inserting the custom inset 
618 \family sans
619 CheckBox
620 \family default
621 .
622  Write inside the inset the label for the box.
623  Here is an example:
624 \begin_inset Newline newline
625 \end_inset
626
627
628 \begin_inset Flex CheckBox
629 status open
630
631 \begin_layout Plain Layout
632 \begin_inset Argument 1
633 status open
634
635 \begin_layout Plain Layout
636 name=age
637 \end_layout
638
639 \end_inset
640
641 Are you older than 18 years?
642 \end_layout
643
644 \end_inset
645
646
647 \end_layout
648
649 \begin_layout Standard
650 You must specify also for check boxes a name.
651  Insert e.
652 \begin_inset space \thinspace{}
653 \end_inset
654
655 g.
656 \begin_inset space \space{}
657 \end_inset
658
659 the parameter 
660 \series bold
661 name=age
662 \series default
663  (where 
664 \series bold
665 age
666 \series default
667  is the name) into the 
668 \family sans
669 Params
670 \family default
671  inset.
672 \end_layout
673
674 \begin_layout Subsection
675 Choice menu
676 \end_layout
677
678 \begin_layout Standard
679 A choice menu is added by inserting the custom inset 
680 \family sans
681 ChoiceMenu
682 \family default
683 .
684  A label for the inset is added by using the menu 
685 \family sans
686 Insert\SpecialChar menuseparator
687 Label
688 \family default
689 .
690  The different choices are inserted to the inset as comma-separated list.
691  There are 3
692 \begin_inset space ~
693 \end_inset
694
695 choice menu types:
696 \end_layout
697
698 \begin_layout Description
699 Radio Only one choice can be selected
700 \end_layout
701
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.
705 \end_layout
706
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.
710 \end_layout
711
712 \begin_layout Standard
713 To determine the choice menu type one uses the parameter 
714 \series bold
715 radio
716 \series default
717
718 \series bold
719 combo
720 \series default
721  or 
722 \series bold
723 popdown
724 \series default
725 .
726 \end_layout
727
728 \begin_layout Standard
729 Here is an example for the radio type:
730 \begin_inset VSpace defskip
731 \end_inset
732
733
734 \begin_inset Newline newline
735 \end_inset
736
737
738 \begin_inset Flex ChoiceMenu
739 status open
740
741 \begin_layout Plain Layout
742 \begin_inset Argument 1
743 status open
744
745 \begin_layout Plain Layout
746 radio, name=radio
747 \end_layout
748
749 \end_inset
750
751 male=m, female=f
752 \begin_inset Argument 2
753 status open
754
755 \begin_layout Plain Layout
756 Sex:
757 \end_layout
758
759 \end_inset
760
761
762 \end_layout
763
764 \end_inset
765
766
767 \end_layout
768
769 \begin_layout Standard
770 Here is an example for the combo type:
771 \begin_inset VSpace defskip
772 \end_inset
773
774
775 \begin_inset Newline newline
776 \end_inset
777
778
779 \begin_inset Flex ChoiceMenu
780 status open
781
782 \begin_layout Plain Layout
783 \begin_inset Argument 1
784 status open
785
786 \begin_layout Plain Layout
787 combo, name=combo
788 \end_layout
789
790 \end_inset
791
792 Albania=Al, Armenia=Ar, Azerbaidschan=Az
793 \begin_inset Argument 2
794 status open
795
796 \begin_layout Plain Layout
797 Country:
798 \end_layout
799
800 \end_inset
801
802
803 \end_layout
804
805 \end_inset
806
807
808 \end_layout
809
810 \begin_layout Standard
811 Here is an example for the popdown type:
812 \begin_inset VSpace defskip
813 \end_inset
814
815
816 \begin_inset Newline newline
817 \end_inset
818
819
820 \begin_inset Flex ChoiceMenu
821 status open
822
823 \begin_layout Plain Layout
824 \begin_inset Argument 1
825 status open
826
827 \begin_layout Plain Layout
828 popdown, name=country
829 \end_layout
830
831 \end_inset
832
833 Albania=Al, Armenia=Ar, Azerbaidschan=Az
834 \begin_inset Argument 2
835 status open
836
837 \begin_layout Plain Layout
838 Country:
839 \end_layout
840
841 \end_inset
842
843
844 \end_layout
845
846 \end_inset
847
848
849 \end_layout
850
851 \begin_layout Standard
852 You must also specify a name for choice menus.
853  Insert for example the parameter 
854 \series bold
855 name=country
856 \series default
857  (where 
858 \series bold
859 country
860 \series default
861  is the name) into the 
862 \family sans
863 Params
864 \family default
865  inset.
866 \end_layout
867
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 
872 \series bold
873 =name
874 \series default
875  behind each choice (where 
876 \series bold
877 name
878 \series default
879  is the choice name).
880  For example the radio type example contains this choice list:
881 \series bold
882  male=m, female=f
883 \series default
884 .
885  If the user chose 
886 \begin_inset Quotes eld
887 \end_inset
888
889 male
890 \begin_inset Quotes erd
891 \end_inset
892
893  you know that he chose the choice 
894 \begin_inset Quotes eld
895 \end_inset
896
897 m
898 \begin_inset Quotes erd
899 \end_inset
900
901 .
902  With the name you can also preset/propose e.g.
903 \begin_inset space \space{}
904 \end_inset
905
906 the choice 
907 \begin_inset Quotes eld
908 \end_inset
909
910 male
911 \begin_inset Quotes erd
912 \end_inset
913
914  by adding the parameter 
915 \series bold
916 default=m
917 \series default
918 .
919  Here is an example:
920 \end_layout
921
922 \begin_layout Standard
923 \begin_inset Flex ChoiceMenu
924 status open
925
926 \begin_layout Plain Layout
927 \begin_inset Argument 1
928 status open
929
930 \begin_layout Plain Layout
931 radio, name=sex, default=m
932 \end_layout
933
934 \end_inset
935
936 male=m, female=f
937 \begin_inset Argument 2
938 status open
939
940 \begin_layout Plain Layout
941 Sex:
942 \end_layout
943
944 \end_inset
945
946
947 \end_layout
948
949 \end_inset
950
951
952 \end_layout
953
954 \begin_layout Subsection
955 Push button
956 \end_layout
957
958 \begin_layout Standard
959 A push button is added by inserting the custom inset 
960 \family sans
961 PushButton
962 \family default
963 .
964  Write inside the inset the label for the button.
965  Here is an example:
966 \end_layout
967
968 \begin_layout Standard
969 \begin_inset Flex PushButton
970 status open
971
972 \begin_layout Plain Layout
973 \begin_inset Argument 1
974 status open
975
976 \begin_layout Plain Layout
977
978 \end_layout
979
980 \end_inset
981
982 Don't click on this button or your fridge will be destroyed!!!
983 \end_layout
984
985 \end_inset
986
987
988 \end_layout
989
990 \begin_layout Standard
991 The action that is triggered by pressing the button is specified by JavaScript
992  code.
993  To do this, add the parameter 
994 \series bold
995 onclick={}
996 \series default
997  and insert the JavaScript code between the braces.
998  For info about JavaScript, see its documentation, 
999 \begin_inset CommandInset citation
1000 LatexCommand cite
1001 key "JavaScript"
1002 literal "true"
1003
1004 \end_inset
1005
1006 .
1007  In the following example this JavaScript code was used:
1008 \begin_inset Newline newline
1009 \end_inset
1010
1011
1012 \series bold
1013 app.alert(
1014 \begin_inset ERT
1015 status collapsed
1016
1017 \begin_layout Plain Layout
1018
1019 "
1020 \end_layout
1021
1022 \end_inset
1023
1024 What the hell? Now you destroyed your fridge.
1025  
1026 \begin_inset Quotes eld
1027 \end_inset
1028
1029 Congratulations.
1030 \begin_inset Quotes erd
1031 \end_inset
1032
1033
1034 \begin_inset ERT
1035 status collapsed
1036
1037 \begin_layout Plain Layout
1038
1039 "
1040 \end_layout
1041
1042 \end_inset
1043
1044 )
1045 \end_layout
1046
1047 \begin_layout Standard
1048 \begin_inset Flex PushButton
1049 status open
1050
1051 \begin_layout Plain Layout
1052 \begin_inset Argument 1
1053 status open
1054
1055 \begin_layout Plain Layout
1056 onclick={app.alert(
1057 \begin_inset ERT
1058 status collapsed
1059
1060 \begin_layout Plain Layout
1061
1062 "
1063 \end_layout
1064
1065 \end_inset
1066
1067 What the hell? Now you destroyed your fridge.
1068  
1069 \begin_inset Quotes eld
1070 \end_inset
1071
1072 Congratulations.
1073 \begin_inset Quotes erd
1074 \end_inset
1075
1076
1077 \begin_inset ERT
1078 status collapsed
1079
1080 \begin_layout Plain Layout
1081
1082 "
1083 \end_layout
1084
1085 \end_inset
1086
1087 )}
1088 \end_layout
1089
1090 \end_inset
1091
1092 Don't click on this button or your fridge will be destroyed!!!
1093 \end_layout
1094
1095 \end_inset
1096
1097
1098 \end_layout
1099
1100 \begin_layout Standard
1101 \begin_inset Note Greyedout
1102 status open
1103
1104 \begin_layout Plain Layout
1105
1106 \series bold
1107 Note:
1108 \series default
1109  The outer quotes are part of the JavaScript code and must therefore be
1110  inserted as \SpecialChar TeX
1111  code!
1112 \end_layout
1113
1114 \end_inset
1115
1116
1117 \end_layout
1118
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.
1122  Here is an example:
1123 \end_layout
1124
1125 \begin_layout Standard
1126 \begin_inset Flex PushButton
1127 status open
1128
1129 \begin_layout Plain Layout
1130 \begin_inset Argument 1
1131 status open
1132
1133 \begin_layout Plain Layout
1134
1135 \end_layout
1136
1137 \end_inset
1138
1139
1140 \begin_inset CommandInset href
1141 LatexCommand href
1142 name "Information how to fill out this form"
1143 target "https://wiki.lyx.org"
1144 literal "false"
1145
1146 \end_inset
1147
1148
1149 \end_layout
1150
1151 \end_inset
1152
1153
1154 \end_layout
1155
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 
1159 \family sans
1160 PDF
1161 \begin_inset space ~
1162 \end_inset
1163
1164 properties
1165 \family default
1166 :
1167 \end_layout
1168
1169 \begin_layout Standard
1170
1171 \series bold
1172 urlbordercolor={1 0 0}
1173 \end_layout
1174
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.
1178 \end_layout
1179
1180 \begin_layout Subsection
1181 Submit button
1182 \begin_inset CommandInset label
1183 LatexCommand label
1184 name "subsec:Submit-button"
1185
1186 \end_inset
1187
1188
1189 \end_layout
1190
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 
1194 \family sans
1195 SubmitButton
1196 \family default
1197 .
1198  The label for the button is written into the inset.
1199  Here is an example:
1200 \end_layout
1201
1202 \begin_layout Standard
1203 \begin_inset Flex SubmitButton
1204 status open
1205
1206 \begin_layout Plain Layout
1207 \begin_inset Argument 1
1208 status open
1209
1210 \begin_layout Plain Layout
1211 name=submit1
1212 \end_layout
1213
1214 \end_inset
1215
1216 Send your data via email
1217 \end_layout
1218
1219 \end_inset
1220
1221
1222 \end_layout
1223
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
1229  have a name.
1230 \end_layout
1231
1232 \begin_layout Standard
1233 \begin_inset Note Greyedout
1234 status open
1235
1236 \begin_layout Plain Layout
1237
1238 \series bold
1239 Note:
1240 \series default
1241  You can only use a submit button if you specified the submit method and
1242  a target in the inset 
1243 \family sans
1244 PDF
1245 \begin_inset space ~
1246 \end_inset
1247
1248 Form
1249 \begin_inset space ~
1250 \end_inset
1251
1252 Parameters
1253 \family default
1254 ! See sec.
1255 \begin_inset space \thinspace{}
1256 \end_inset
1257
1258
1259 \begin_inset CommandInset ref
1260 LatexCommand ref
1261 reference "sec:Preparation"
1262
1263 \end_inset
1264
1265  for the description.
1266  If there are no specifications you will get \SpecialChar LaTeX
1267  errors.
1268 \end_layout
1269
1270 \end_inset
1271
1272
1273 \end_layout
1274
1275 \begin_layout Subsection
1276 Reset button
1277 \end_layout
1278
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 
1282 \family sans
1283 ResetButton
1284 \family default
1285 .
1286  The label for the button is written into the inset.
1287  Here is an example:
1288 \end_layout
1289
1290 \begin_layout Standard
1291 \begin_inset Flex ResetButton
1292 status open
1293
1294 \begin_layout Plain Layout
1295 \begin_inset Argument 1
1296 status open
1297
1298 \begin_layout Plain Layout
1299 name=reset1
1300 \end_layout
1301
1302 \end_inset
1303
1304 Reset the form
1305 \end_layout
1306
1307 \end_inset
1308
1309
1310 \end_layout
1311
1312 \begin_layout Section
1313 Form element customization
1314 \begin_inset CommandInset label
1315 LatexCommand label
1316 name "sec:Form-element-customization"
1317
1318 \end_inset
1319
1320
1321 \end_layout
1322
1323 \begin_layout Standard
1324 Since all form elements should look uniform, one can determine their layout
1325  using the following styles:
1326 \end_layout
1327
1328 \begin_layout Description
1329 Text
1330 \begin_inset space ~
1331 \end_inset
1332
1333 Field
1334 \begin_inset space ~
1335 \end_inset
1336
1337 Style
1338 \end_layout
1339
1340 \begin_layout Description
1341 Check
1342 \begin_inset space ~
1343 \end_inset
1344
1345 Box
1346 \begin_inset space ~
1347 \end_inset
1348
1349 Style
1350 \end_layout
1351
1352 \begin_layout Description
1353 List
1354 \begin_inset space ~
1355 \end_inset
1356
1357 Box
1358 \begin_inset space ~
1359 \end_inset
1360
1361 Style affects all choice menu types
1362 \end_layout
1363
1364 \begin_layout Description
1365 Combo
1366 \begin_inset space ~
1367 \end_inset
1368
1369 Box
1370 \begin_inset space ~
1371 \end_inset
1372
1373 Style affects only the combo box style
1374 \end_layout
1375
1376 \begin_layout Description
1377 Popdown
1378 \begin_inset space ~
1379 \end_inset
1380
1381 Box
1382 \begin_inset space ~
1383 \end_inset
1384
1385 Style affects only the popdown box style
1386 \end_layout
1387
1388 \begin_layout Description
1389 Radio
1390 \begin_inset space ~
1391 \end_inset
1392
1393 Box
1394 \begin_inset space ~
1395 \end_inset
1396
1397 Style affects only the radio box style
1398 \end_layout
1399
1400 \begin_layout Description
1401 Push
1402 \begin_inset space ~
1403 \end_inset
1404
1405 Button
1406 \begin_inset space ~
1407 \end_inset
1408
1409 Style
1410 \end_layout
1411
1412 \begin_layout Description
1413 Submit
1414 \begin_inset space ~
1415 \end_inset
1416
1417 Button
1418 \begin_inset space ~
1419 \end_inset
1420
1421 Style
1422 \end_layout
1423
1424 \begin_layout Description
1425 Reset
1426 \begin_inset space ~
1427 \end_inset
1428
1429 Button
1430 \begin_inset space ~
1431 \end_inset
1432
1433 Style
1434 \end_layout
1435
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{}
1440 \end_inset
1441
1442 6.2 
1443 \begin_inset Quotes eld
1444 \end_inset
1445
1446 Forms optional parameters
1447 \begin_inset Quotes erd
1448 \end_inset
1449
1450  of the documentation of the \SpecialChar LaTeX
1451  package 
1452 \series bold
1453 hyperref
1454 \series default
1455
1456 \begin_inset CommandInset citation
1457 LatexCommand cite
1458 key "hyperref"
1459 literal "true"
1460
1461 \end_inset
1462
1463 .
1464  It is important that the parameter 
1465 \emph on
1466 print
1467 \emph default
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.
1471 \end_layout
1472
1473 \begin_layout Subsubsection*
1474 Here are some examples:
1475 \end_layout
1476
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
1481 status open
1482
1483 \begin_layout Plain Layout
1484 The parameter 
1485 \series bold
1486 borderstyle
1487 \series default
1488  can be 
1489 \series bold
1490 U
1491 \series default
1492  (underlined), 
1493 \series bold
1494 S
1495 \series default
1496  (solid), 
1497 \series bold
1498 D
1499 \series default
1500  (dashed), 
1501 \series bold
1502 B
1503 \series default
1504  (bevel) or 
1505 \series bold
1506 I
1507 \series default
1508  (inverted bevel).
1509 \end_layout
1510
1511 \end_inset
1512
1513
1514 \end_layout
1515
1516 \begin_layout Check Box Style
1517 print, borderstyle=S, checkboxsymbol=
1518 \backslash
1519 ding{55}
1520 \end_layout
1521
1522 \begin_layout Combo Box Style
1523 print, bordercolor={0.33 0.66 0.33}, borderstyle=D
1524 \end_layout
1525
1526 \begin_layout Popdown Box Style
1527 print, menulength=2
1528 \begin_inset Note Note
1529 status collapsed
1530
1531 \begin_layout Plain Layout
1532 The parameter
1533 \series bold
1534  menulength
1535 \series default
1536  determines the number of displayed menu entries.
1537  It does not work currently because of a bug in the \SpecialChar LaTeX
1538  package 
1539 \series bold
1540 hyperref
1541 \series default
1542 .
1543 \end_layout
1544
1545 \end_inset
1546
1547
1548 \end_layout
1549
1550 \begin_layout Radio Box Style
1551 print, borderstyle=I, radiosymbol=3
1552 \end_layout
1553
1554 \begin_layout Push Button Style
1555 print, borderstyle=B, bordercolor=lime
1556 \end_layout
1557
1558 \begin_layout Submit Button Style
1559 print, borderwidth=0, bordercolor=white
1560 \end_layout
1561
1562 \begin_layout Reset Button Style
1563 print, bordercolor=lime
1564 \end_layout
1565
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{}
1570 \end_inset
1571
1572 pt font size and a limitation for maximal 10
1573 \begin_inset space ~
1574 \end_inset
1575
1576 characters to insert:
1577 \begin_inset VSpace defskip
1578 \end_inset
1579
1580
1581 \begin_inset Newline newline
1582 \end_inset
1583
1584
1585 \begin_inset Flex TextField
1586 status open
1587
1588 \begin_layout Plain Layout
1589 \begin_inset Argument 1
1590 status open
1591
1592 \begin_layout Plain Layout
1593
1594 \end_layout
1595
1596 \end_inset
1597
1598 Enter your name here:
1599 \end_layout
1600
1601 \end_inset
1602
1603
1604 \end_layout
1605
1606 \begin_layout Standard
1607 \begin_inset Note Greyedout
1608 status open
1609
1610 \begin_layout Plain Layout
1611
1612 \series bold
1613 Note:
1614 \series default
1615  To see in 
1616 \emph on
1617 Adobe Reader
1618 \emph default
1619  and 
1620 \emph on
1621 Acrobat
1622 \emph default
1623  custom background colors you must disable in these programs the highlighting
1624  of form fields.
1625  (Option 
1626 \begin_inset Quotes eld
1627 \end_inset
1628
1629 Show border hover color for fields
1630 \begin_inset Quotes erd
1631 \end_inset
1632
1633 )
1634 \end_layout
1635
1636 \end_inset
1637
1638
1639 \end_layout
1640
1641 \begin_layout Itemize
1642 Check box with normal border and symbol 
1643 \backslash
1644 ding{55}:
1645 \begin_inset VSpace defskip
1646 \end_inset
1647
1648
1649 \begin_inset Newline newline
1650 \end_inset
1651
1652
1653 \begin_inset Flex CheckBox
1654 status open
1655
1656 \begin_layout Plain Layout
1657 \begin_inset Argument 1
1658 status open
1659
1660 \begin_layout Plain Layout
1661
1662 \end_layout
1663
1664 \end_inset
1665
1666 Are you older than 18 years?
1667 \end_layout
1668
1669 \end_inset
1670
1671
1672 \end_layout
1673
1674 \begin_layout Standard
1675 The symbol is either specified as number or with the command
1676 \begin_inset Newline newline
1677 \end_inset
1678
1679
1680 \series bold
1681
1682 \backslash
1683 ding{number}
1684 \series default
1685
1686 \begin_inset Newline newline
1687 \end_inset
1688
1689 where 
1690 \series bold
1691 number
1692 \series default
1693  is one of the possible numbers listed in Table
1694 \begin_inset space ~
1695 \end_inset
1696
1697 2 of the documentation of the \SpecialChar LaTeX
1698  package 
1699 \series bold
1700 pifont
1701 \series default
1702
1703 \begin_inset CommandInset citation
1704 LatexCommand cite
1705 key "pifont"
1706 literal "true"
1707
1708 \end_inset
1709
1710 .
1711 \end_layout
1712
1713 \begin_layout Itemize
1714 Combo choice menu with dashed, colored border where the last entry is preselecte
1715 d:
1716 \begin_inset VSpace defskip
1717 \end_inset
1718
1719
1720 \begin_inset Newline newline
1721 \end_inset
1722
1723
1724 \begin_inset Flex ChoiceMenu
1725 status open
1726
1727 \begin_layout Plain Layout
1728 \begin_inset Argument 1
1729 status open
1730
1731 \begin_layout Plain Layout
1732 combo, name=combo2, default=Az
1733 \end_layout
1734
1735 \end_inset
1736
1737 Albania=Al, Armenia=Ar, Azerbaidschan=Az
1738 \begin_inset Argument 2
1739 status open
1740
1741 \begin_layout Plain Layout
1742 Country:
1743 \end_layout
1744
1745 \end_inset
1746
1747
1748 \end_layout
1749
1750 \end_inset
1751
1752
1753 \end_layout
1754
1755 \begin_layout Itemize
1756 Popdown choice menu where the second entry is preselected:
1757 \begin_inset VSpace defskip
1758 \end_inset
1759
1760
1761 \begin_inset Newline newline
1762 \end_inset
1763
1764
1765 \begin_inset Flex ChoiceMenu
1766 status open
1767
1768 \begin_layout Plain Layout
1769 \begin_inset Argument 1
1770 status open
1771
1772 \begin_layout Plain Layout
1773 popdown, name=country2, default=Ar
1774 \end_layout
1775
1776 \end_inset
1777
1778 Albania=Al, Armenia=Ar, Azerbaidschan=Az
1779 \begin_inset Argument 2
1780 status open
1781
1782 \begin_layout Plain Layout
1783 Country:
1784 \end_layout
1785
1786 \end_inset
1787
1788
1789 \end_layout
1790
1791 \end_inset
1792
1793
1794 \end_layout
1795
1796 \begin_layout Standard
1797 \begin_inset VSpace defskip
1798 \end_inset
1799
1800
1801 \begin_inset Note Greyedout
1802 status open
1803
1804 \begin_layout Plain Layout
1805
1806 \series bold
1807 Note: 
1808 \series default
1809 The parameters 
1810 \series bold
1811 borderstyle B
1812 \series default
1813  and 
1814 \series bold
1815 I
1816 \series default
1817  and 
1818 \series bold
1819 color
1820 \series default
1821  have no effect for popdown choice menus.
1822 \end_layout
1823
1824 \end_inset
1825
1826
1827 \end_layout
1828
1829 \begin_layout Itemize
1830 Radio choice menu with inverted bevel border and symbol number
1831 \begin_inset space ~
1832 \end_inset
1833
1834 3 as checkmark:
1835 \begin_inset VSpace defskip
1836 \end_inset
1837
1838
1839 \begin_inset Newline newline
1840 \end_inset
1841
1842
1843 \begin_inset Flex ChoiceMenu
1844 status open
1845
1846 \begin_layout Plain Layout
1847 \begin_inset Argument 1
1848 status open
1849
1850 \begin_layout Plain Layout
1851 radio, name=radio2
1852 \end_layout
1853
1854 \end_inset
1855
1856 male=m, female=f
1857 \begin_inset Argument 2
1858 status open
1859
1860 \begin_layout Plain Layout
1861 Sex:
1862 \end_layout
1863
1864 \end_inset
1865
1866
1867 \end_layout
1868
1869 \end_inset
1870
1871
1872 \end_layout
1873
1874 \begin_layout Standard
1875 \begin_inset VSpace defskip
1876 \end_inset
1877
1878
1879 \begin_inset Note Greyedout
1880 status open
1881
1882 \begin_layout Plain Layout
1883
1884 \series bold
1885 Note:
1886 \series default
1887  The parameters 
1888 \series bold
1889 backgroundcolor
1890 \series default
1891
1892 \series bold
1893 color
1894 \series default
1895
1896 \series bold
1897 height 
1898 \series default
1899 and 
1900 \series bold
1901 width
1902 \series default
1903  have no effect for push, submit and reset buttons.
1904 \end_layout
1905
1906 \end_inset
1907
1908
1909 \end_layout
1910
1911 \begin_layout Standard
1912 As workaround use a colored box and/or color the box text.
1913 \end_layout
1914
1915 \begin_layout Itemize
1916 Push button with a bevel border and colored text:
1917 \begin_inset VSpace defskip
1918 \end_inset
1919
1920
1921 \begin_inset Newline newline
1922 \end_inset
1923
1924
1925 \begin_inset Flex PushButton
1926 status open
1927
1928 \begin_layout Plain Layout
1929 \begin_inset Argument 1
1930 status open
1931
1932 \begin_layout Plain Layout
1933 onclick={app.alert(
1934 \begin_inset ERT
1935 status collapsed
1936
1937 \begin_layout Plain Layout
1938
1939 "
1940 \end_layout
1941
1942 \end_inset
1943
1944 Why do you click this?
1945 \begin_inset ERT
1946 status collapsed
1947
1948 \begin_layout Plain Layout
1949
1950 "
1951 \end_layout
1952
1953 \end_inset
1954
1955 )}
1956 \end_layout
1957
1958 \end_inset
1959
1960
1961 \begin_inset Box Frameless
1962 position "t"
1963 hor_pos "c"
1964 has_inner_box 1
1965 inner_pos "t"
1966 use_parbox 0
1967 use_makebox 1
1968 width ""
1969 special "none"
1970 height "1in"
1971 height_special "totalheight"
1972 thickness "0.4pt"
1973 separation "3pt"
1974 shadowsize "4pt"
1975 framecolor "black"
1976 backgroundcolor "lime"
1977 status open
1978
1979 \begin_layout Plain Layout
1980
1981 \color red
1982 Don't click on this button!!!
1983 \end_layout
1984
1985 \end_inset
1986
1987
1988 \end_layout
1989
1990 \end_inset
1991
1992
1993 \begin_inset VSpace bigskip
1994 \end_inset
1995
1996
1997 \end_layout
1998
1999 \begin_layout Itemize
2000 Submit button without border, with cyan background and increased height:
2001 \begin_inset VSpace defskip
2002 \end_inset
2003
2004
2005 \begin_inset Newline newline
2006 \end_inset
2007
2008
2009 \begin_inset Flex SubmitButton
2010 status open
2011
2012 \begin_layout Plain Layout
2013 \begin_inset Argument 1
2014 status open
2015
2016 \begin_layout Plain Layout
2017 name=submit2
2018 \end_layout
2019
2020 \end_inset
2021
2022
2023 \begin_inset Box Frameless
2024 position "c"
2025 hor_pos "c"
2026 has_inner_box 1
2027 inner_pos "c"
2028 use_parbox 0
2029 use_makebox 1
2030 width "6cm"
2031 special "none"
2032 height "1in"
2033 height_special "totalheight"
2034 thickness "0.4pt"
2035 separation "3pt"
2036 shadowsize "4pt"
2037 framecolor "black"
2038 backgroundcolor "cyan"
2039 status open
2040
2041 \begin_layout Plain Layout
2042 \begin_inset Box Frameless
2043 position "c"
2044 hor_pos "c"
2045 has_inner_box 1
2046 inner_pos "c"
2047 use_parbox 1
2048 use_makebox 0
2049 width "4.5cm"
2050 special "none"
2051 height "4in"
2052 height_special "totalheight"
2053 thickness "0.4pt"
2054 separation "3pt"
2055 shadowsize "4pt"
2056 framecolor "black"
2057 backgroundcolor "none"
2058 status open
2059
2060 \begin_layout Plain Layout
2061 Send your data via mail
2062 \end_layout
2063
2064 \end_inset
2065
2066
2067 \end_layout
2068
2069 \end_inset
2070
2071
2072 \end_layout
2073
2074 \end_inset
2075
2076
2077 \begin_inset VSpace bigskip
2078 \end_inset
2079
2080
2081 \end_layout
2082
2083 \begin_layout Itemize
2084 Reset button with a width of 7
2085 \begin_inset space \thinspace{}
2086 \end_inset
2087
2088 cm:
2089 \begin_inset VSpace defskip
2090 \end_inset
2091
2092
2093 \begin_inset Newline newline
2094 \end_inset
2095
2096
2097 \begin_inset Flex ResetButton
2098 status open
2099
2100 \begin_layout Plain Layout
2101 \begin_inset Argument 1
2102 status open
2103
2104 \begin_layout Plain Layout
2105 name=reset2
2106 \end_layout
2107
2108 \end_inset
2109
2110
2111 \begin_inset Box Frameless
2112 position "t"
2113 hor_pos "c"
2114 has_inner_box 1
2115 inner_pos "t"
2116 use_parbox 0
2117 use_makebox 1
2118 width "7cm"
2119 special "none"
2120 height "1in"
2121 height_special "totalheight"
2122 thickness "0.4pt"
2123 separation "3pt"
2124 shadowsize "4pt"
2125 framecolor "black"
2126 backgroundcolor "none"
2127 status open
2128
2129 \begin_layout Plain Layout
2130 Reset the form
2131 \end_layout
2132
2133 \end_inset
2134
2135
2136 \end_layout
2137
2138 \end_inset
2139
2140
2141 \end_layout
2142
2143 \begin_layout Standard
2144 \begin_inset Newpage newpage
2145 \end_inset
2146
2147
2148 \end_layout
2149
2150 \begin_layout Section
2151 PDF action buttons
2152 \end_layout
2153
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
2158  the custom inset 
2159 \family sans
2160 PDFAction
2161 \family default
2162 .
2163  The PDF viewers 
2164 \emph on
2165 Acrobat
2166 \emph default
2167  and 
2168 \emph on
2169 Adobe Reader
2170 \emph default
2171  can handle all possible actions while other PDF viewers might only support
2172  some of them.
2173  However, all PDF viewers support the basic things like printing, save
2174 \begin_inset space ~
2175 \end_inset
2176
2177 as, view in fullscreen etc..
2178 \end_layout
2179
2180 \begin_layout Standard
2181 To specify the action insert its name to the 
2182 \family sans
2183 Action
2184 \family default
2185  inset.
2186  A list with possible action names can be found in sec.
2187 \begin_inset space \thinspace{}
2188 \end_inset
2189
2190
2191 \begin_inset Quotes eld
2192 \end_inset
2193
2194 Acrobat-specific behavior
2195 \begin_inset Quotes erd
2196 \end_inset
2197
2198  of the documentation of the \SpecialChar LaTeX
2199  package 
2200 \series bold
2201 hyperref
2202 \series default
2203
2204 \begin_inset CommandInset citation
2205 LatexCommand cite
2206 key "hyperref"
2207 literal "true"
2208
2209 \end_inset
2210
2211 .
2212 \end_layout
2213
2214 \begin_layout Standard
2215 Here are some examples:
2216 \end_layout
2217
2218 \begin_layout Description
2219 Printing: 
2220 \begin_inset Flex PDFAction
2221 status open
2222
2223 \begin_layout Plain Layout
2224 \begin_inset Argument 1
2225 status open
2226
2227 \begin_layout Plain Layout
2228 Print
2229 \end_layout
2230
2231 \end_inset
2232
2233 Print the document
2234 \end_layout
2235
2236 \end_inset
2237
2238
2239 \end_layout
2240
2241 \begin_layout Description
2242 Save
2243 \begin_inset space ~
2244 \end_inset
2245
2246 as: 
2247 \begin_inset Flex PDFAction
2248 status open
2249
2250 \begin_layout Plain Layout
2251 \begin_inset Argument 1
2252 status open
2253
2254 \begin_layout Plain Layout
2255 SaveAs
2256 \end_layout
2257
2258 \end_inset
2259
2260 Save document as
2261 \end_layout
2262
2263 \end_inset
2264
2265
2266 \end_layout
2267
2268 \begin_layout Description
2269 View
2270 \begin_inset space ~
2271 \end_inset
2272
2273 in
2274 \begin_inset space ~
2275 \end_inset
2276
2277 fullscreen: 
2278 \begin_inset Flex PDFAction
2279 status open
2280
2281 \begin_layout Plain Layout
2282 \begin_inset Argument 1
2283 status open
2284
2285 \begin_layout Plain Layout
2286 FullScreen
2287 \end_layout
2288
2289 \end_inset
2290
2291 View the form in fullscreen
2292 \end_layout
2293
2294 \end_inset
2295
2296
2297 \end_layout
2298
2299 \begin_layout Subsection
2300 Action button customization
2301 \begin_inset CommandInset label
2302 LatexCommand label
2303 name "subsec:Action-button-customization"
2304
2305 \end_inset
2306
2307
2308 \end_layout
2309
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
2313  parameters.
2314 \end_layout
2315
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{}
2320 \end_inset
2321
2322 cm wide and have the height of 2
2323 \begin_inset space ~
2324 \end_inset
2325
2326 lines.
2327  Then create this parbox:
2328 \end_layout
2329
2330 \begin_layout Standard
2331 \begin_inset Box Frameless
2332 position "c"
2333 hor_pos "c"
2334 has_inner_box 1
2335 inner_pos "c"
2336 use_parbox 1
2337 use_makebox 0
2338 width "5cm"
2339 special "none"
2340 height "2in"
2341 height_special "totalheight"
2342 thickness "0.4pt"
2343 separation "3pt"
2344 shadowsize "4pt"
2345 framecolor "black"
2346 backgroundcolor "none"
2347 status open
2348
2349 \begin_layout Plain Layout
2350 \noindent
2351 Save form as
2352 \end_layout
2353
2354 \end_inset
2355
2356
2357 \end_layout
2358
2359 \begin_layout Standard
2360 inside a 
2361 \family sans
2362 PDFAction
2363 \family default
2364  inset.
2365  This is the result:
2366 \end_layout
2367
2368 \begin_layout Standard
2369 \begin_inset Flex PDFAction
2370 status open
2371
2372 \begin_layout Plain Layout
2373 \begin_inset Argument 1
2374 status open
2375
2376 \begin_layout Plain Layout
2377 SaveAs
2378 \end_layout
2379
2380 \end_inset
2381
2382
2383 \begin_inset Box Frameless
2384 position "c"
2385 hor_pos "c"
2386 has_inner_box 1
2387 inner_pos "c"
2388 use_parbox 1
2389 use_makebox 0
2390 width "5cm"
2391 special "none"
2392 height "2in"
2393 height_special "totalheight"
2394 thickness "0.4pt"
2395 separation "3pt"
2396 shadowsize "4pt"
2397 framecolor "black"
2398 backgroundcolor "none"
2399 status open
2400
2401 \begin_layout Plain Layout
2402 Save form as
2403 \end_layout
2404
2405 \end_inset
2406
2407
2408 \end_layout
2409
2410 \end_inset
2411
2412
2413 \end_layout
2414
2415 \begin_layout PDF Link Setup
2416 pdfborder={0 0 0}
2417 \begin_inset Note Note
2418 status open
2419
2420 \begin_layout Plain Layout
2421 Sets the thickness of the predefined link border to zero as described below.
2422 \end_layout
2423
2424 \end_inset
2425
2426
2427 \end_layout
2428
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.
2432  An example with a 4
2433 \begin_inset space \thinspace{}
2434 \end_inset
2435
2436 pt thick, teal border and 3
2437 \begin_inset space \thinspace{}
2438 \end_inset
2439
2440 pt border separation :
2441 \begin_inset VSpace defskip
2442 \end_inset
2443
2444
2445 \begin_inset Newline newline
2446 \end_inset
2447
2448
2449 \begin_inset Flex PDFAction
2450 status open
2451
2452 \begin_layout Plain Layout
2453 \begin_inset Argument 1
2454 status open
2455
2456 \begin_layout Plain Layout
2457 SaveAs
2458 \end_layout
2459
2460 \end_inset
2461
2462
2463 \begin_inset Box Boxed
2464 position "c"
2465 hor_pos "c"
2466 has_inner_box 1
2467 inner_pos "c"
2468 use_parbox 1
2469 use_makebox 0
2470 width "5cm"
2471 special "none"
2472 height "2in"
2473 height_special "totalheight"
2474 thickness "4pt"
2475 separation "3pt"
2476 shadowsize "4pt"
2477 framecolor "teal"
2478 backgroundcolor "white"
2479 status open
2480
2481 \begin_layout Plain Layout
2482 \noindent
2483 Save form as
2484 \end_layout
2485
2486 \end_inset
2487
2488
2489 \end_layout
2490
2491 \end_inset
2492
2493
2494 \end_layout
2495
2496 \begin_layout Standard
2497 To customize the border thickness, add the command 
2498 \series bold
2499 pdfborder={0 0 t}
2500 \series default
2501  to the additional options in the document settings under 
2502 \family sans
2503 PDF
2504 \begin_inset space ~
2505 \end_inset
2506
2507 properties
2508 \family default
2509  and replace 
2510 \series bold
2511 t
2512 \series default
2513  with a number that is the thickness in pixels.
2514  If you want to change the border thickness only for certain buttons, use
2515  the environment 
2516 \family sans
2517 PDF
2518 \begin_inset space ~
2519 \end_inset
2520
2521 link
2522 \begin_inset space ~
2523 \end_inset
2524
2525 setup
2526 \family default
2527  before the button and insert there the command 
2528 \series bold
2529 pdfborder
2530 \series default
2531 .
2532  The default value of 
2533 \series bold
2534 pdfborder
2535 \series default
2536  is 
2537 \series bold
2538 {0 0 1}
2539 \series default
2540 .
2541 \end_layout
2542
2543 \begin_layout Standard
2544 \begin_inset Note Greyedout
2545 status open
2546
2547 \begin_layout Plain Layout
2548
2549 \series bold
2550 Note:
2551 \series default
2552  
2553 \series bold
2554 pdfborder
2555 \series default
2556  affects all link types, not only the action links.
2557 \end_layout
2558
2559 \end_inset
2560
2561
2562 \end_layout
2563
2564 \begin_layout PDF Link Setup
2565 pdfborder={0 0 4}
2566 \end_layout
2567
2568 \begin_layout Standard
2569 An example with a 4
2570 \begin_inset space ~
2571 \end_inset
2572
2573 pixel thick border:
2574 \begin_inset Newline newline
2575 \end_inset
2576
2577
2578 \begin_inset Flex PDFAction
2579 status open
2580
2581 \begin_layout Plain Layout
2582 \begin_inset Argument 1
2583 status open
2584
2585 \begin_layout Plain Layout
2586 SaveAs
2587 \end_layout
2588
2589 \end_inset
2590
2591
2592 \begin_inset Box Frameless
2593 position "c"
2594 hor_pos "c"
2595 has_inner_box 1
2596 inner_pos "c"
2597 use_parbox 1
2598 use_makebox 0
2599 width "5cm"
2600 special "none"
2601 height "2in"
2602 height_special "totalheight"
2603 thickness "0.4pt"
2604 separation "3pt"
2605 shadowsize "4pt"
2606 framecolor "black"
2607 backgroundcolor "none"
2608 status open
2609
2610 \begin_layout Plain Layout
2611 \noindent
2612 Save form as
2613 \end_layout
2614
2615 \end_inset
2616
2617
2618 \end_layout
2619
2620 \end_inset
2621
2622
2623 \end_layout
2624
2625 \begin_layout Standard
2626 To change the border color use the command 
2627 \series bold
2628 menubordercolor={r g b}
2629 \series default
2630  where 
2631 \series bold
2632 r
2633 \series default
2634
2635 \series bold
2636 g
2637 \series default
2638  and 
2639 \series bold
2640 b
2641 \series default
2642  are numbers between 0 and 1 for the colors red, green and blue.
2643  The default value of 
2644 \series bold
2645 menubordercolor
2646 \series default
2647  is 
2648 \series bold
2649 {1 0 0}
2650 \series default
2651 .
2652 \end_layout
2653
2654 \begin_layout PDF Link Setup
2655 pdfborder={0 0 1}, menubordercolor={0.1 0.9 0.5}
2656 \end_layout
2657
2658 \begin_layout Standard
2659 An example with 
2660 \series bold
2661 menubordercolor={0.1 0.9 0.5}
2662 \series default
2663 :
2664 \begin_inset Newline newline
2665 \end_inset
2666
2667
2668 \begin_inset Flex PDFAction
2669 status open
2670
2671 \begin_layout Plain Layout
2672 \begin_inset Argument 1
2673 status open
2674
2675 \begin_layout Plain Layout
2676 SaveAs
2677 \end_layout
2678
2679 \end_inset
2680
2681
2682 \begin_inset Box Frameless
2683 position "c"
2684 hor_pos "c"
2685 has_inner_box 1
2686 inner_pos "c"
2687 use_parbox 1
2688 use_makebox 0
2689 width "5cm"
2690 special "none"
2691 height "2in"
2692 height_special "totalheight"
2693 thickness "0.4pt"
2694 separation "3pt"
2695 shadowsize "4pt"
2696 framecolor "black"
2697 backgroundcolor "none"
2698 status open
2699
2700 \begin_layout Plain Layout
2701 \noindent
2702 Save form as
2703 \end_layout
2704
2705 \end_inset
2706
2707
2708 \end_layout
2709
2710 \end_inset
2711
2712
2713 \end_layout
2714
2715 \begin_layout Standard
2716 To change the background color use a colored box.
2717 \end_layout
2718
2719 \begin_layout PDF Link Setup
2720 pdfborder={0 0 0}
2721 \end_layout
2722
2723 \begin_layout Standard
2724 An example without a border and with lime background color:
2725 \begin_inset Newline newline
2726 \end_inset
2727
2728
2729 \begin_inset Flex PDFAction
2730 status open
2731
2732 \begin_layout Plain Layout
2733 \begin_inset Argument 1
2734 status open
2735
2736 \begin_layout Plain Layout
2737 SaveAs
2738 \end_layout
2739
2740 \end_inset
2741
2742
2743 \begin_inset Box Frameless
2744 position "c"
2745 hor_pos "c"
2746 has_inner_box 1
2747 inner_pos "c"
2748 use_parbox 1
2749 use_makebox 0
2750 width "5cm"
2751 special "none"
2752 height "2in"
2753 height_special "totalheight"
2754 thickness "0.4pt"
2755 separation "3pt"
2756 shadowsize "4pt"
2757 framecolor "black"
2758 backgroundcolor "lime"
2759 status open
2760
2761 \begin_layout Plain Layout
2762 \noindent
2763 Save form as
2764 \end_layout
2765
2766 \end_inset
2767
2768
2769 \end_layout
2770
2771 \end_inset
2772
2773
2774 \end_layout
2775
2776 \begin_layout PDF Link Setup
2777 pdfborder={0 0 1}, menubordercolor={1 0 0}
2778 \end_layout
2779
2780 \begin_layout Section
2781 Dynamic form elements
2782 \end_layout
2783
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:
2789 \end_layout
2790
2791 \begin_layout Standard
2792
2793 \series bold
2794
2795 \backslash
2796 usepackage[pdftex]{insdljs}
2797 \begin_inset Newline newline
2798 \end_inset
2799
2800
2801 \backslash
2802 pdfcatalog{/AA 
2803 \backslash
2804 the
2805 \backslash
2806 pdflastobj
2807 \backslash
2808 space 0 R}
2809 \end_layout
2810
2811 \begin_layout Standard
2812 Then add the necessary JavaScript code to your document LaTeX preamble or
2813  as \SpecialChar TeX
2814  code to your document.
2815  For info about JavaScript, see its documentation, 
2816 \begin_inset CommandInset citation
2817 LatexCommand cite
2818 key "JavaScript"
2819 literal "true"
2820
2821 \end_inset
2822
2823 .
2824 \end_layout
2825
2826 \begin_layout Standard
2827 \begin_inset ERT
2828 status collapsed
2829
2830 \begin_layout Plain Layout
2831
2832
2833 \backslash
2834 ifinsdljs
2835 \end_layout
2836
2837 \end_inset
2838
2839
2840 \begin_inset Note Note
2841 status open
2842
2843 \begin_layout Plain Layout
2844 The following section will only be displayed when the \SpecialChar LaTeX
2845  package 
2846 \series bold
2847 insdljs
2848 \series default
2849  is installed.
2850 \end_layout
2851
2852 \end_inset
2853
2854
2855 \end_layout
2856
2857 \begin_layout Standard
2858 For the following choice menu this JavaScript code was used:
2859 \end_layout
2860
2861 \begin_layout Standard
2862 \begin_inset listings
2863 lstparams "language=TeX"
2864 inline false
2865 status open
2866
2867 \begin_layout Plain Layout
2868
2869
2870 \backslash
2871 begin{insDLJS}[exaaae]{exaaae}{JavaScript}
2872 \end_layout
2873
2874 \begin_layout Plain Layout
2875
2876  function validateTime(){
2877 \end_layout
2878
2879 \begin_layout Plain Layout
2880
2881   this.delay = true;
2882 \end_layout
2883
2884 \begin_layout Plain Layout
2885
2886   if((event.value == "u") || (event.value == "unlimited")) {
2887 \end_layout
2888
2889 \begin_layout Plain Layout
2890
2891    this.getField("from").display = display.hidden;
2892 \end_layout
2893
2894 \begin_layout Plain Layout
2895
2896    this.getField("until").display = display.hidden;
2897 \end_layout
2898
2899 \begin_layout Plain Layout
2900
2901   } else {
2902 \end_layout
2903
2904 \begin_layout Plain Layout
2905
2906    this.getField("from").display = display.visible;
2907 \end_layout
2908
2909 \begin_layout Plain Layout
2910
2911    this.getField("until").display = display.visible;
2912 \end_layout
2913
2914 \begin_layout Plain Layout
2915
2916    this.getField("from").setFocus();
2917 \end_layout
2918
2919 \begin_layout Plain Layout
2920
2921   }
2922 \end_layout
2923
2924 \begin_layout Plain Layout
2925
2926   this.delay = false;
2927 \end_layout
2928
2929 \begin_layout Plain Layout
2930
2931  }
2932 \end_layout
2933
2934 \begin_layout Plain Layout
2935
2936
2937 \backslash
2938 end{insDLJS}
2939 \end_layout
2940
2941 \end_inset
2942
2943
2944 \end_layout
2945
2946 \begin_layout Standard
2947 \begin_inset Note Greyedout
2948 status open
2949
2950 \begin_layout Plain Layout
2951
2952 \series bold
2953 Note:
2954 \series default
2955  
2956 \emph on
2957 All
2958 \emph default
2959  JavaScript functions must be inserted into the same 
2960 \family sans
2961 insDLJS
2962 \family default
2963  environment.
2964 \end_layout
2965
2966 \end_inset
2967
2968
2969 \end_layout
2970
2971 \begin_layout Standard
2972 The 
2973 \family sans
2974 Parameters
2975 \family default
2976  of the following choice menu are
2977 \begin_inset Newline newline
2978 \end_inset
2979
2980
2981 \series bold
2982 name=contract,radio,default=tl,validate={validateTime();}
2983 \end_layout
2984
2985 \begin_layout Standard
2986 \begin_inset Flex ChoiceMenu
2987 status open
2988
2989 \begin_layout Plain Layout
2990 \begin_inset Argument 1
2991 status open
2992
2993 \begin_layout Plain Layout
2994 name=contract,radio,default=tl,validate={validateTime();}
2995 \end_layout
2996
2997 \end_inset
2998
2999 term-limited=tl, unlimited=u
3000 \begin_inset Argument 2
3001 status open
3002
3003 \begin_layout Plain Layout
3004 Job contract:
3005 \end_layout
3006
3007 \end_inset
3008
3009
3010 \end_layout
3011
3012 \end_inset
3013
3014
3015 \begin_inset VSpace defskip
3016 \end_inset
3017
3018
3019 \end_layout
3020
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">
3027 <row>
3028 <cell alignment="left" valignment="top" usebox="none">
3029 \begin_inset Text
3030
3031 \begin_layout Plain Layout
3032 From:
3033 \end_layout
3034
3035 \end_inset
3036 </cell>
3037 <cell alignment="center" valignment="top" usebox="none">
3038 \begin_inset Text
3039
3040 \begin_layout Plain Layout
3041 \begin_inset Flex TextField
3042 status open
3043
3044 \begin_layout Plain Layout
3045 \begin_inset Argument 1
3046 status open
3047
3048 \begin_layout Plain Layout
3049 name=from,width=10em
3050 \end_layout
3051
3052 \end_inset
3053
3054
3055 \end_layout
3056
3057 \end_inset
3058
3059
3060 \end_layout
3061
3062 \end_inset
3063 </cell>
3064 </row>
3065 <row>
3066 <cell alignment="center" valignment="top" usebox="none">
3067 \begin_inset Text
3068
3069 \begin_layout Plain Layout
3070
3071 \end_layout
3072
3073 \end_inset
3074 </cell>
3075 <cell alignment="center" valignment="top" usebox="none">
3076 \begin_inset Text
3077
3078 \begin_layout Plain Layout
3079 \begin_inset VSpace -1.5mm
3080 \end_inset
3081
3082
3083 \end_layout
3084
3085 \end_inset
3086 </cell>
3087 </row>
3088 <row>
3089 <cell alignment="left" valignment="top" usebox="none">
3090 \begin_inset Text
3091
3092 \begin_layout Plain Layout
3093 Until:
3094 \end_layout
3095
3096 \end_inset
3097 </cell>
3098 <cell alignment="center" valignment="top" usebox="none">
3099 \begin_inset Text
3100
3101 \begin_layout Plain Layout
3102 \begin_inset Flex TextField
3103 status open
3104
3105 \begin_layout Plain Layout
3106 \begin_inset Argument 1
3107 status open
3108
3109 \begin_layout Plain Layout
3110 name=until,width=10em
3111 \end_layout
3112
3113 \end_inset
3114
3115
3116 \end_layout
3117
3118 \end_inset
3119
3120
3121 \end_layout
3122
3123 \end_inset
3124 </cell>
3125 </row>
3126 </lyxtabular>
3127
3128 \end_inset
3129
3130
3131 \end_layout
3132
3133 \begin_layout Standard
3134 \begin_inset VSpace bigskip
3135 \end_inset
3136
3137
3138 \end_layout
3139
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:
3143 \end_layout
3144
3145 \begin_layout Standard
3146 \begin_inset listings
3147 lstparams "language=TeX"
3148 inline false
3149 status open
3150
3151 \begin_layout Plain Layout
3152
3153 function checkNumber() {
3154 \end_layout
3155
3156 \begin_layout Plain Layout
3157
3158  event.rc = true;
3159 \end_layout
3160
3161 \begin_layout Plain Layout
3162
3163  if (!Number(event.value)) {
3164 \end_layout
3165
3166 \begin_layout Plain Layout
3167
3168   app.alert("Value must be a number!");
3169 \end_layout
3170
3171 \begin_layout Plain Layout
3172
3173   event.value = "";
3174 \end_layout
3175
3176 \begin_layout Plain Layout
3177
3178  } else {
3179 \end_layout
3180
3181 \begin_layout Plain Layout
3182
3183   event.target.textColor = color.green;
3184 \end_layout
3185
3186 \begin_layout Plain Layout
3187
3188 }
3189 \end_layout
3190
3191 \end_inset
3192
3193
3194 \end_layout
3195
3196 \begin_layout Standard
3197 An example text field: 
3198 \begin_inset Flex TextField
3199 status open
3200
3201 \begin_layout Plain Layout
3202 \begin_inset Argument 1
3203 status open
3204
3205 \begin_layout Plain Layout
3206 name=onlyNumbers, align=1, validate={checkNumber();}
3207 \end_layout
3208
3209 \end_inset
3210
3211
3212 \end_layout
3213
3214 \end_inset
3215
3216
3217 \end_layout
3218
3219 \begin_layout Standard
3220 \begin_inset ERT
3221 status collapsed
3222
3223 \begin_layout Plain Layout
3224
3225
3226 \backslash
3227 else
3228 \end_layout
3229
3230 \end_inset
3231
3232
3233 \begin_inset Note Note
3234 status open
3235
3236 \begin_layout Plain Layout
3237 The following will be displayed when the \SpecialChar LaTeX
3238  package 
3239 \series bold
3240 insdljs
3241 \series default
3242  is not installed:
3243 \end_layout
3244
3245 \end_inset
3246
3247
3248 \end_layout
3249
3250 \begin_layout Standard
3251 You need to install the package 
3252 \series bold
3253 insdljs
3254 \series default
3255  to see the content of this section in the output.
3256 \end_layout
3257
3258 \begin_layout Standard
3259 \begin_inset ERT
3260 status collapsed
3261
3262 \begin_layout Plain Layout
3263
3264
3265 \backslash
3266 fi
3267 \end_layout
3268
3269 \end_inset
3270
3271
3272 \end_layout
3273
3274 \begin_layout End PDF Form
3275 \begin_inset Note Note
3276 status open
3277
3278 \begin_layout Plain Layout
3279 keep this empty
3280 \end_layout
3281
3282 \end_inset
3283
3284
3285 \end_layout
3286
3287 \begin_layout Section
3288 General notes
3289 \end_layout
3290
3291 \begin_layout Itemize
3292 Submitting and applying data requires that all form elements have a name.
3293 \end_layout
3294
3295 \begin_layout Itemize
3296 Creating a PDF form requires pdf\SpecialChar TeX
3297  or Lua\SpecialChar TeX
3298 .
3299  Use therefore either the \SpecialChar LyX
3300  export formats 
3301 \family sans
3302 PDF (pdflatex)
3303 \family default
3304  or 
3305 \family sans
3306 PDF (LuaTeX)
3307 \family default
3308 .
3309 \end_layout
3310
3311 \begin_layout Itemize
3312 To see in 
3313 \emph on
3314 Adobe Reader
3315 \emph default
3316  and 
3317 \emph on
3318 Acrobat
3319 \emph default
3320  custom background colors you must disable in these programs the highlighting
3321  of form fields.
3322  (Option 
3323 \begin_inset Quotes eld
3324 \end_inset
3325
3326 Show border hover color for fields
3327 \begin_inset Quotes erd
3328 \end_inset
3329
3330 )
3331 \end_layout
3332
3333 \begin_layout Bibliography
3334 \begin_inset CommandInset bibitem
3335 LatexCommand bibitem
3336 key "JavaScript"
3337 literal "true"
3338
3339 \end_inset
3340
3341
3342 \begin_inset CommandInset href
3343 LatexCommand href
3344 name "JavaScript reference"
3345 target "https://developer.mozilla.org/en/docs/Web/JavaScript/Reference"
3346 literal "false"
3347
3348 \end_inset
3349
3350
3351 \end_layout
3352
3353 \begin_layout Bibliography
3354 \begin_inset CommandInset bibitem
3355 LatexCommand bibitem
3356 key "hyperref"
3357 literal "true"
3358
3359 \end_inset
3360
3361
3362 \begin_inset CommandInset href
3363 LatexCommand href
3364 name "Documentation"
3365 target "https://ctan.org/tex-archive/macros/latex/contrib/hyperref/doc/manual.pdf"
3366 literal "false"
3367
3368 \end_inset
3369
3370  of the \SpecialChar LaTeX
3371  package 
3372 \series bold
3373 hyperref
3374 \end_layout
3375
3376 \begin_layout Bibliography
3377 \begin_inset CommandInset bibitem
3378 LatexCommand bibitem
3379 key "pifont"
3380 literal "true"
3381
3382 \end_inset
3383
3384
3385 \begin_inset CommandInset href
3386 LatexCommand href
3387 name "Documentation"
3388 target "https://ctan.org/tex-archive/macros/latex/required/psnfss/psnfss2e.pdf"
3389 literal "false"
3390
3391 \end_inset
3392
3393  of the \SpecialChar LaTeX
3394  package 
3395 \series bold
3396 pifont
3397 \end_layout
3398
3399 \end_body
3400 \end_document