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