]> git.lyx.org Git - lyx.git/blob - lib/examples/PDF-form.lyx
Set default format to "default" for Japanese docs
[lyx.git] / lib / examples / PDF-form.lyx
1 #LyX 2.3 created this file. For more info see http://www.lyx.org/
2 \lyxformat 544
3 \begin_document
4 \begin_header
5 \save_transient_properties true
6 \origin /systemlyxdir/examples/
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 \end_preamble
64 \options BCOR8mm,pagesize
65 \use_default_options false
66 \begin_modules
67 pdfform
68 \end_modules
69 \maintain_unincluded_children false
70 \language english
71 \language_package default
72 \inputencoding auto
73 \fontencoding global
74 \font_roman "default" "default"
75 \font_sans "default" "default"
76 \font_typewriter "default" "default"
77 \font_math "auto" "auto"
78 \font_default_family default
79 \use_non_tex_fonts false
80 \font_sc false
81 \font_osf false
82 \font_sf_scale 100 100
83 \font_tt_scale 100 100
84 \use_microtype false
85 \use_dash_ligatures false
86 \graphics default
87 \default_output_format pdf2
88 \output_sync 0
89 \bibtex_command bibtex
90 \index_command default
91 \paperfontsize 12
92 \spacing single
93 \use_hyperref true
94 \pdf_title "Description of the module pdfcomment"
95 \pdf_author "Uwe Stöhr"
96 \pdf_subject "PDF form"
97 \pdf_keywords "LyX, PDF forms, hyperref"
98 \pdf_bookmarks true
99 \pdf_bookmarksnumbered true
100 \pdf_bookmarksopen true
101 \pdf_bookmarksopenlevel 2
102 \pdf_breaklinks false
103 \pdf_pdfborder false
104 \pdf_colorlinks false
105 \pdf_backref false
106 \pdf_pdfusetitle false
107 \pdf_quoted_options "pdfpagelayout=OneColumn, pdfnewwindow=true, pdfstartview=XYZ, plainpages=false, urlbordercolor={1 0 0}"
108 \papersize a4paper
109 \use_geometry false
110 \use_package amsmath 1
111 \use_package amssymb 1
112 \use_package cancel 0
113 \use_package esint 1
114 \use_package mathdots 1
115 \use_package mathtools 1
116 \use_package mhchem 1
117 \use_package stackrel 0
118 \use_package stmaryrd 0
119 \use_package undertilde 0
120 \cite_engine basic
121 \cite_engine_type default
122 \biblio_style plain
123 \use_bibtopic false
124 \use_indices false
125 \paperorientation portrait
126 \suppress_date true
127 \justification true
128 \use_refstyle 0
129 \notefontcolor #0000ff
130 \index Index
131 \shortcut idx
132 \color #008000
133 \end_index
134 \secnumdepth 3
135 \tocdepth 2
136 \paragraph_separation skip
137 \defskip medskip
138 \is_math_indent 0
139 \math_numbering_side default
140 \quotes_style english
141 \papercolumns 1
142 \papersides 1
143 \paperpagestyle default
144 \tracking_changes false
145 \output_changes false
146 \html_math_output 0
147 \html_css_as_file 0
148 \html_be_strict false
149 \use_minted 0
150 \end_header
151
152 \begin_body
153
154 \begin_layout Begin PDF Form
155
156 \begin_inset Argument 1
157 status open
158
159 \begin_layout Plain Layout
160 action=mailto:forms@lyx.test?subject=The submitted PDF form, method=post
161 \end_layout
162
163 \end_inset
164
165
166 \end_layout
167
168 \begin_layout Title
169 Description of the module PDF Form
170 \end_layout
171
172 \begin_layout Author
173 Uwe Stöhr
174 \end_layout
175
176 \begin_layout Standard
177 \begin_inset Note Note
178 status open
179
180 \begin_layout Plain Layout
181 To export all parts of this document to PDF the \SpecialChar LaTeX
182 -package 
183 \series bold
184 insdljs
185 \series default
186  must be installed.
187  If it is not installed you can export the document anyway but the example
188  in the section about dynamic form elements will not appear in the output.
189 \end_layout
190
191 \end_inset
192
193
194 \end_layout
195
196 \begin_layout Standard
197 By loading the module PDF
198 \begin_inset space ~
199 \end_inset
200
201 Form the whole document or a part of it can be made a PDF form.
202  You can add all possible form elements like text fields buttons etc.
203  This document describes how this is done.
204 \end_layout
205
206 \begin_layout Section
207 Preparation
208 \begin_inset CommandInset label
209 LatexCommand label
210 name "sec:Preparation"
211
212 \end_inset
213
214
215 \end_layout
216
217 \begin_layout Standard
218 At first load the module PDF
219 \begin_inset space ~
220 \end_inset
221
222 Form in the document settings of your file.
223  To make the whole document a form, insert the environment
224 \family sans
225  Begin
226 \begin_inset space ~
227 \end_inset
228
229 PDF
230 \begin_inset space ~
231 \end_inset
232
233 Form
234 \family default
235  from \SpecialChar LyX
236 's dropdown menu at the beginning of the document.
237  If only a part of the document should be a form, add 
238 \family sans
239 Begin
240 \begin_inset space ~
241 \end_inset
242
243 PDF
244 \begin_inset space ~
245 \end_inset
246
247 Form
248 \family default
249  at the position where the form should start.
250 \end_layout
251
252 \begin_layout Standard
253 \begin_inset Note Greyedout
254 status open
255
256 \begin_layout Plain Layout
257
258 \series bold
259 Note:
260 \series default
261  It is only possible to have one form in a PDF file!
262 \end_layout
263
264 \end_inset
265
266
267 \end_layout
268
269 \begin_layout Standard
270 If the form data should be submitted to a server or the like, then you must
271  specify the URL as parameter of the 
272 \family sans
273 Begin
274 \begin_inset space ~
275 \end_inset
276
277 PDF
278 \begin_inset space ~
279 \end_inset
280
281 Form
282 \family default
283  environment.
284  This is done by using the menu 
285 \family sans
286 Insert\SpecialChar menuseparator
287 PDF
288 \begin_inset space ~
289 \end_inset
290
291 Form
292 \begin_inset space ~
293 \end_inset
294
295 Parameters
296 \family default
297 .
298  For example in this document the following was inserted to the parameter
299  inset:
300 \end_layout
301
302 \begin_layout Standard
303
304 \series bold
305 action=mailto:forms@lyx.test?subject=The submitted PDF form,
306 \begin_inset Newline newline
307 \end_inset
308
309 method=post
310 \end_layout
311
312 \begin_layout Standard
313 This sends the form data as email to 
314 \emph on
315 forms@lyx.test
316 \emph default
317  when the user presses the submit button.
318  The email subject will be 
319 \begin_inset Quotes eld
320 \end_inset
321
322 The submitted PDF form
323 \begin_inset Quotes erd
324 \end_inset
325
326  and the submit method is 
327 \series bold
328 post
329 \series default
330 .
331  (The other possible method would be 
332 \series bold
333 get
334 \series default
335 .) For more about submitting see sec.
336 \begin_inset space \thinspace{}
337 \end_inset
338
339
340 \begin_inset CommandInset ref
341 LatexCommand ref
342 reference "subsec:Submit-button"
343
344 \end_inset
345
346 .
347 \end_layout
348
349 \begin_layout Standard
350 \begin_inset Newpage newpage
351 \end_inset
352
353
354 \end_layout
355
356 \begin_layout Section
357 Form elements
358 \end_layout
359
360 \begin_layout Standard
361 There are 6
362 \begin_inset space ~
363 \end_inset
364
365 possible elements in a PDF form:
366 \end_layout
367
368 \begin_layout Subsection
369 Text field
370 \end_layout
371
372 \begin_layout Standard
373 A text field is added by inserting the custom inset 
374 \family sans
375 TextField
376 \family default
377  using the menu 
378 \family sans
379 Insert\SpecialChar menuseparator
380 Custom
381 \begin_inset space ~
382 \end_inset
383
384 Insets
385 \family default
386 .
387  Write inside the inset the label for the text field that will be printed
388  in the PDF output before the field.
389  Here is an example:
390 \begin_inset Newline newline
391 \end_inset
392
393
394 \begin_inset Flex TextField
395 status open
396
397 \begin_layout Plain Layout
398 \begin_inset Argument 1
399 status open
400
401 \begin_layout Plain Layout
402 name=customer
403 \end_layout
404
405 \end_inset
406
407 Enter your name here:
408 \end_layout
409
410 \end_inset
411
412
413 \end_layout
414
415 \begin_layout Standard
416 You must also specify a name for text fields.
417  To do this set the cursor into its 
418 \family sans
419 Params
420 \family default
421  inset and insert the parameter 
422 \series bold
423 name=customer
424 \series default
425  (where 
426 \series bold
427 customer
428 \series default
429  is the field name).
430 \end_layout
431
432 \begin_layout Standard
433 Using the same name for several text fields results in an automatic duplication
434  of the inserted text.
435  This is for example useful if the user should input a date that should
436  appear at different places in the form.
437 \begin_inset Newline newline
438 \end_inset
439
440 Here are 2
441 \begin_inset space ~
442 \end_inset
443
444 fields as example: Fill one and see that the other one will be filled automatica
445 lly when you click outside of the field:
446 \begin_inset Newline newline
447 \end_inset
448
449
450 \begin_inset Flex TextField
451 status open
452
453 \begin_layout Plain Layout
454 \begin_inset Argument 1
455 status open
456
457 \begin_layout Plain Layout
458 name=identic
459 \end_layout
460
461 \end_inset
462
463
464 \end_layout
465
466 \end_inset
467
468
469 \begin_inset Newline newline
470 \end_inset
471
472
473 \begin_inset Flex TextField
474 status open
475
476 \begin_layout Plain Layout
477 \begin_inset Argument 1
478 status open
479
480 \begin_layout Plain Layout
481 name=identic
482 \end_layout
483
484 \end_inset
485
486
487 \end_layout
488
489 \end_inset
490
491
492 \end_layout
493
494 \begin_layout Standard
495 \begin_inset Note Greyedout
496 status open
497
498 \begin_layout Plain Layout
499
500 \series bold
501 Note:
502 \series default
503  Special characters should be avoided in element names.
504 \end_layout
505
506 \end_inset
507
508
509 \end_layout
510
511 \begin_layout Standard
512 All form fields can be customized by adding parameters.
513 \end_layout
514
515 \begin_layout Standard
516 Here is a customized multiline text field with a width of 60
517 \begin_inset space \thinspace{}
518 \end_inset
519
520 % of the text width, 3
521 \begin_inset space \thinspace{}
522 \end_inset
523
524 cm height and a proposed content:
525 \begin_inset VSpace defskip
526 \end_inset
527
528
529 \begin_inset Newline newline
530 \end_inset
531
532
533 \begin_inset Flex TextField
534 status open
535
536 \begin_layout Plain Layout
537 \begin_inset Argument 1
538 status open
539
540 \begin_layout Plain Layout
541 name=customer2, multiline, width=0.6
542 \backslash
543 textwidth, height=3cm, value={proposed text}
544 \end_layout
545
546 \end_inset
547
548 Enter your name here:
549 \end_layout
550
551 \end_inset
552
553
554 \end_layout
555
556 \begin_layout Standard
557 \begin_inset Note Greyedout
558 status open
559
560 \begin_layout Plain Layout
561
562 \series bold
563 Note:
564 \series default
565  It is highly recommended to use a uniform layout of all fields in a form.
566  See sec.
567 \begin_inset space \thinspace{}
568 \end_inset
569
570
571 \begin_inset CommandInset ref
572 LatexCommand ref
573 reference "sec:Form-element-customization"
574
575 \end_inset
576
577  how this is done.
578 \end_layout
579
580 \end_inset
581
582
583 \end_layout
584
585 \begin_layout Subsection
586 Check box
587 \end_layout
588
589 \begin_layout Standard
590 A check box is added by inserting the custom inset 
591 \family sans
592 CheckBox
593 \family default
594 .
595  Write inside the inset the label for the box.
596  Here is an example:
597 \begin_inset Newline newline
598 \end_inset
599
600
601 \begin_inset Flex CheckBox
602 status open
603
604 \begin_layout Plain Layout
605 \begin_inset Argument 1
606 status open
607
608 \begin_layout Plain Layout
609 name=age
610 \end_layout
611
612 \end_inset
613
614 Are you older than 18 years?
615 \end_layout
616
617 \end_inset
618
619
620 \end_layout
621
622 \begin_layout Standard
623 You must specify also for check boxes a name.
624  Insert e.
625 \begin_inset space \thinspace{}
626 \end_inset
627
628 g.
629 \begin_inset space \space{}
630 \end_inset
631
632 the parameter 
633 \series bold
634 name=age
635 \series default
636  (where 
637 \series bold
638 age
639 \series default
640  is the name) into the 
641 \family sans
642 Params
643 \family default
644  inset.
645 \end_layout
646
647 \begin_layout Subsection
648 Choice menu
649 \end_layout
650
651 \begin_layout Standard
652 A choice menu is added by inserting the custom inset 
653 \family sans
654 ChoiceMenu
655 \family default
656 .
657  A label for the inset is added by using the menu 
658 \family sans
659 Insert\SpecialChar menuseparator
660 Label
661 \family default
662 .
663  The different choices are inserted to the inset as comma-separated list.
664  There are 3
665 \begin_inset space ~
666 \end_inset
667
668 choice menu types:
669 \end_layout
670
671 \begin_layout Description
672 Radio Only one choice can be selected
673 \end_layout
674
675 \begin_layout Description
676 Combo The choices are listed in a combo box (dropdown list) but the user
677  is allowed to input something that is not in the predefined list.
678 \end_layout
679
680 \begin_layout Description
681 Popdown All choices are listed below each other.
682  If the menu is not high enough a scroll bar is automatically added.
683 \end_layout
684
685 \begin_layout Standard
686 To determine the choice menu type one uses the parameter 
687 \series bold
688 radio
689 \series default
690
691 \series bold
692 combo
693 \series default
694  or 
695 \series bold
696 popdown
697 \series default
698 .
699 \end_layout
700
701 \begin_layout Standard
702 Here is an example for the radio type:
703 \begin_inset VSpace defskip
704 \end_inset
705
706
707 \begin_inset Newline newline
708 \end_inset
709
710
711 \begin_inset Flex ChoiceMenu
712 status open
713
714 \begin_layout Plain Layout
715 \begin_inset Argument 1
716 status open
717
718 \begin_layout Plain Layout
719 radio, name=radio
720 \end_layout
721
722 \end_inset
723
724 male=m, female=f
725 \begin_inset Argument 2
726 status open
727
728 \begin_layout Plain Layout
729 Sex:
730 \end_layout
731
732 \end_inset
733
734
735 \end_layout
736
737 \end_inset
738
739
740 \end_layout
741
742 \begin_layout Standard
743 Here is an example for the combo type:
744 \begin_inset VSpace defskip
745 \end_inset
746
747
748 \begin_inset Newline newline
749 \end_inset
750
751
752 \begin_inset Flex ChoiceMenu
753 status open
754
755 \begin_layout Plain Layout
756 \begin_inset Argument 1
757 status open
758
759 \begin_layout Plain Layout
760 combo, name=combo
761 \end_layout
762
763 \end_inset
764
765 Albania=Al, Armenia=Ar, Azerbaidschan=Az
766 \begin_inset Argument 2
767 status open
768
769 \begin_layout Plain Layout
770 Country:
771 \end_layout
772
773 \end_inset
774
775
776 \end_layout
777
778 \end_inset
779
780
781 \end_layout
782
783 \begin_layout Standard
784 Here is an example for the popdown type:
785 \begin_inset VSpace defskip
786 \end_inset
787
788
789 \begin_inset Newline newline
790 \end_inset
791
792
793 \begin_inset Flex ChoiceMenu
794 status open
795
796 \begin_layout Plain Layout
797 \begin_inset Argument 1
798 status open
799
800 \begin_layout Plain Layout
801 popdown, name=country
802 \end_layout
803
804 \end_inset
805
806 Albania=Al, Armenia=Ar, Azerbaidschan=Az
807 \begin_inset Argument 2
808 status open
809
810 \begin_layout Plain Layout
811 Country:
812 \end_layout
813
814 \end_inset
815
816
817 \end_layout
818
819 \end_inset
820
821
822 \end_layout
823
824 \begin_layout Standard
825 You must also specify a name for choice menus.
826  Insert for example the parameter 
827 \series bold
828 name=country
829 \series default
830  (where 
831 \series bold
832 country
833 \series default
834  is the name) into the 
835 \family sans
836 Params
837 \family default
838  inset.
839 \end_layout
840
841 \begin_layout Standard
842 It is recommended to add a short name for every choice to be able to access
843  them and to know which one was chosen by the user.
844  This is done by adding 
845 \series bold
846 =name
847 \series default
848  behind each choice (where 
849 \series bold
850 name
851 \series default
852  is the choice name).
853  For example the radio type example contains this choice list:
854 \series bold
855  male=m, female=f
856 \series default
857 .
858  If the user chose 
859 \begin_inset Quotes eld
860 \end_inset
861
862 male
863 \begin_inset Quotes erd
864 \end_inset
865
866  you know that he chose the choice 
867 \begin_inset Quotes eld
868 \end_inset
869
870 m
871 \begin_inset Quotes erd
872 \end_inset
873
874 .
875  With the name you can also preset/propose e.g.
876 \begin_inset space \space{}
877 \end_inset
878
879 the choice 
880 \begin_inset Quotes eld
881 \end_inset
882
883 male
884 \begin_inset Quotes erd
885 \end_inset
886
887  by adding the parameter 
888 \series bold
889 default=m
890 \series default
891 .
892  Here is an example:
893 \end_layout
894
895 \begin_layout Standard
896 \begin_inset Flex ChoiceMenu
897 status open
898
899 \begin_layout Plain Layout
900 \begin_inset Argument 1
901 status open
902
903 \begin_layout Plain Layout
904 radio, name=sex, default=m
905 \end_layout
906
907 \end_inset
908
909 male=m, female=f
910 \begin_inset Argument 2
911 status open
912
913 \begin_layout Plain Layout
914 Sex:
915 \end_layout
916
917 \end_inset
918
919
920 \end_layout
921
922 \end_inset
923
924
925 \end_layout
926
927 \begin_layout Subsection
928 Push button
929 \end_layout
930
931 \begin_layout Standard
932 A push button is added by inserting the custom inset 
933 \family sans
934 PushButton
935 \family default
936 .
937  Write inside the inset the label for the button.
938  Here is an example:
939 \end_layout
940
941 \begin_layout Standard
942 \begin_inset Flex PushButton
943 status open
944
945 \begin_layout Plain Layout
946 \begin_inset Argument 1
947 status open
948
949 \begin_layout Plain Layout
950
951 \end_layout
952
953 \end_inset
954
955 Don't click on this button or your fridge will be destroyed!!!
956 \end_layout
957
958 \end_inset
959
960
961 \end_layout
962
963 \begin_layout Standard
964 The action that is triggered by pressing the button is specified by JavaScript
965  code.
966  To do this, add the parameter 
967 \series bold
968 onclick={}
969 \series default
970  and insert the JavaScript code between the braces.
971  For info about JavaScript, see its documentation, 
972 \begin_inset CommandInset citation
973 LatexCommand cite
974 key "JavaScript"
975 literal "true"
976
977 \end_inset
978
979 .
980  In the following example this JavaScript code was used:
981 \begin_inset Newline newline
982 \end_inset
983
984
985 \series bold
986 app.alert(
987 \begin_inset ERT
988 status collapsed
989
990 \begin_layout Plain Layout
991
992 "
993 \end_layout
994
995 \end_inset
996
997 What the hell? Now you destroyed your fridge.
998  
999 \begin_inset Quotes eld
1000 \end_inset
1001
1002 Congratulations.
1003 \begin_inset Quotes erd
1004 \end_inset
1005
1006
1007 \begin_inset ERT
1008 status collapsed
1009
1010 \begin_layout Plain Layout
1011
1012 "
1013 \end_layout
1014
1015 \end_inset
1016
1017 )
1018 \end_layout
1019
1020 \begin_layout Standard
1021 \begin_inset Flex PushButton
1022 status open
1023
1024 \begin_layout Plain Layout
1025 \begin_inset Argument 1
1026 status open
1027
1028 \begin_layout Plain Layout
1029 onclick={app.alert(
1030 \begin_inset ERT
1031 status collapsed
1032
1033 \begin_layout Plain Layout
1034
1035 "
1036 \end_layout
1037
1038 \end_inset
1039
1040 What the hell? Now you destroyed your fridge.
1041  
1042 \begin_inset Quotes eld
1043 \end_inset
1044
1045 Congratulations.
1046 \begin_inset Quotes erd
1047 \end_inset
1048
1049
1050 \begin_inset ERT
1051 status collapsed
1052
1053 \begin_layout Plain Layout
1054
1055 "
1056 \end_layout
1057
1058 \end_inset
1059
1060 )}
1061 \end_layout
1062
1063 \end_inset
1064
1065 Don't click on this button or your fridge will be destroyed!!!
1066 \end_layout
1067
1068 \end_inset
1069
1070
1071 \end_layout
1072
1073 \begin_layout Standard
1074 \begin_inset Note Greyedout
1075 status open
1076
1077 \begin_layout Plain Layout
1078
1079 \series bold
1080 Note:
1081 \series default
1082  The outer quotes are part of the JavaScript code and must therefore be
1083  inserted as \SpecialChar TeX
1084  code!
1085 \end_layout
1086
1087 \end_inset
1088
1089
1090 \end_layout
1091
1092 \begin_layout Standard
1093 A common usage for push buttons is to open a weblink.
1094  Such a button is created by inserting a hyperlink as button text.
1095  Here is an example:
1096 \end_layout
1097
1098 \begin_layout Standard
1099 \begin_inset Flex PushButton
1100 status open
1101
1102 \begin_layout Plain Layout
1103 \begin_inset Argument 1
1104 status open
1105
1106 \begin_layout Plain Layout
1107
1108 \end_layout
1109
1110 \end_inset
1111
1112
1113 \begin_inset CommandInset href
1114 LatexCommand href
1115 name "Information how to fill out this form"
1116 target "http://wiki.lyx.org"
1117 literal "false"
1118
1119 \end_inset
1120
1121
1122 \end_layout
1123
1124 \end_inset
1125
1126
1127 \end_layout
1128
1129 \begin_layout Standard
1130 To get rid of the predefined frame for weblinks add this to the additional
1131  options in the document settings under 
1132 \family sans
1133 PDF
1134 \begin_inset space ~
1135 \end_inset
1136
1137 properties
1138 \family default
1139 :
1140 \end_layout
1141
1142 \begin_layout Standard
1143
1144 \series bold
1145 urlbordercolor={1 0 0}
1146 \end_layout
1147
1148 \begin_layout Standard
1149 if your push button border color is red (the default), otherwise use the
1150  same color definition as for your push button border color.
1151 \end_layout
1152
1153 \begin_layout Subsection
1154 Submit button
1155 \begin_inset CommandInset label
1156 LatexCommand label
1157 name "subsec:Submit-button"
1158
1159 \end_inset
1160
1161
1162 \end_layout
1163
1164 \begin_layout Standard
1165 A submit button is used to submit the form data to a server.
1166  It is added by inserting the custom inset 
1167 \family sans
1168 SubmitButton
1169 \family default
1170 .
1171  The label for the button is written into the inset.
1172  Here is an example:
1173 \end_layout
1174
1175 \begin_layout Standard
1176 \begin_inset Flex SubmitButton
1177 status open
1178
1179 \begin_layout Plain Layout
1180 \begin_inset Argument 1
1181 status open
1182
1183 \begin_layout Plain Layout
1184 name=submit1
1185 \end_layout
1186
1187 \end_inset
1188
1189 Send your data via email
1190 \end_layout
1191
1192 \end_inset
1193
1194
1195 \end_layout
1196
1197 \begin_layout Standard
1198 The submit button creates a forms data format (FDF) file (file extension
1199  *.fdf) which is then submitted.
1200  The FDF file contains only the form data.
1201  They can later only be applied to a PDF form if all elements in the form
1202  have a name.
1203 \end_layout
1204
1205 \begin_layout Standard
1206 \begin_inset Note Greyedout
1207 status open
1208
1209 \begin_layout Plain Layout
1210
1211 \series bold
1212 Note:
1213 \series default
1214  You can only use a submit button if you specified the submit method and
1215  a target in the inset 
1216 \family sans
1217 PDF
1218 \begin_inset space ~
1219 \end_inset
1220
1221 Form
1222 \begin_inset space ~
1223 \end_inset
1224
1225 Parameters
1226 \family default
1227 ! See sec.
1228 \begin_inset space \thinspace{}
1229 \end_inset
1230
1231
1232 \begin_inset CommandInset ref
1233 LatexCommand ref
1234 reference "sec:Preparation"
1235
1236 \end_inset
1237
1238  for the description.
1239  If there are no specifications you will get \SpecialChar LaTeX
1240  errors.
1241 \end_layout
1242
1243 \end_inset
1244
1245
1246 \end_layout
1247
1248 \begin_layout Subsection
1249 Reset button
1250 \end_layout
1251
1252 \begin_layout Standard
1253 A reset button is used to reset all form elements to the initial state.
1254  It is added by inserting the custom inset 
1255 \family sans
1256 ResetButton
1257 \family default
1258 .
1259  The label for the button is written into the inset.
1260  Here is an example:
1261 \end_layout
1262
1263 \begin_layout Standard
1264 \begin_inset Flex ResetButton
1265 status open
1266
1267 \begin_layout Plain Layout
1268 \begin_inset Argument 1
1269 status open
1270
1271 \begin_layout Plain Layout
1272 name=reset1
1273 \end_layout
1274
1275 \end_inset
1276
1277 Reset the form
1278 \end_layout
1279
1280 \end_inset
1281
1282
1283 \end_layout
1284
1285 \begin_layout Section
1286 Form element customization
1287 \begin_inset CommandInset label
1288 LatexCommand label
1289 name "sec:Form-element-customization"
1290
1291 \end_inset
1292
1293
1294 \end_layout
1295
1296 \begin_layout Standard
1297 Since all form elements should look uniform, one can determine their layout
1298  using the following styles:
1299 \end_layout
1300
1301 \begin_layout Description
1302 Text
1303 \begin_inset space ~
1304 \end_inset
1305
1306 Field
1307 \begin_inset space ~
1308 \end_inset
1309
1310 Style
1311 \end_layout
1312
1313 \begin_layout Description
1314 Check
1315 \begin_inset space ~
1316 \end_inset
1317
1318 Box
1319 \begin_inset space ~
1320 \end_inset
1321
1322 Style
1323 \end_layout
1324
1325 \begin_layout Description
1326 List
1327 \begin_inset space ~
1328 \end_inset
1329
1330 Box
1331 \begin_inset space ~
1332 \end_inset
1333
1334 Style affects all choice menu types
1335 \end_layout
1336
1337 \begin_layout Description
1338 Combo
1339 \begin_inset space ~
1340 \end_inset
1341
1342 Box
1343 \begin_inset space ~
1344 \end_inset
1345
1346 Style affects only the combo box style
1347 \end_layout
1348
1349 \begin_layout Description
1350 Popdown
1351 \begin_inset space ~
1352 \end_inset
1353
1354 Box
1355 \begin_inset space ~
1356 \end_inset
1357
1358 Style affects only the popdown box style
1359 \end_layout
1360
1361 \begin_layout Description
1362 Radio
1363 \begin_inset space ~
1364 \end_inset
1365
1366 Box
1367 \begin_inset space ~
1368 \end_inset
1369
1370 Style affects only the radio box style
1371 \end_layout
1372
1373 \begin_layout Description
1374 Push
1375 \begin_inset space ~
1376 \end_inset
1377
1378 Button
1379 \begin_inset space ~
1380 \end_inset
1381
1382 Style
1383 \end_layout
1384
1385 \begin_layout Description
1386 Submit
1387 \begin_inset space ~
1388 \end_inset
1389
1390 Button
1391 \begin_inset space ~
1392 \end_inset
1393
1394 Style
1395 \end_layout
1396
1397 \begin_layout Description
1398 Reset
1399 \begin_inset space ~
1400 \end_inset
1401
1402 Button
1403 \begin_inset space ~
1404 \end_inset
1405
1406 Style
1407 \end_layout
1408
1409 \begin_layout Standard
1410 The content of the styles is a comma-separated list of parameters.
1411  The possible parameters are listed in sec.
1412 \begin_inset space \thinspace{}
1413 \end_inset
1414
1415 6.2 
1416 \begin_inset Quotes eld
1417 \end_inset
1418
1419 Forms optional parameters
1420 \begin_inset Quotes erd
1421 \end_inset
1422
1423  of the documentation of the \SpecialChar LaTeX
1424  package 
1425 \series bold
1426 hyperref
1427 \series default
1428
1429 \begin_inset CommandInset citation
1430 LatexCommand cite
1431 key "hyperref"
1432 literal "true"
1433
1434 \end_inset
1435
1436 .
1437  It is important that the parameter 
1438 \emph on
1439 print
1440 \emph default
1441  is always part of the definition.
1442  Otherwise the elements will not appear in the PDF.
1443  The defined style is applied to all elements following the definition.
1444 \end_layout
1445
1446 \begin_layout Subsubsection*
1447 Here are some examples:
1448 \end_layout
1449
1450 \begin_layout Text Field Style
1451
1452 print, bordercolor=red, borderstyle=U, backgroundcolor=lightgray, color=lime,
1453  maxlen=10, align=2, charsize=16pt
1454 \begin_inset Note Note
1455 status open
1456
1457 \begin_layout Plain Layout
1458 The parameter 
1459 \series bold
1460 borderstyle
1461 \series default
1462  can be 
1463 \series bold
1464 U
1465 \series default
1466  (underlined), 
1467 \series bold
1468 S
1469 \series default
1470  (solid), 
1471 \series bold
1472 D
1473 \series default
1474  (dashed), 
1475 \series bold
1476 B
1477 \series default
1478  (bevel) or 
1479 \series bold
1480 I
1481 \series default
1482  (inverted bevel).
1483 \end_layout
1484
1485 \end_inset
1486
1487
1488 \end_layout
1489
1490 \begin_layout Check Box Style
1491
1492 print, borderstyle=S, checkboxsymbol=
1493 \backslash
1494 ding{55}
1495 \end_layout
1496
1497 \begin_layout Combo Box Style
1498
1499 print, bordercolor={0.33 0.66 0.33}, borderstyle=D
1500 \end_layout
1501
1502 \begin_layout Popdown Box Style
1503
1504 print, menulength=2
1505 \begin_inset Note Note
1506 status collapsed
1507
1508 \begin_layout Plain Layout
1509 The parameter
1510 \series bold
1511  menulength
1512 \series default
1513  determines the number of displayed menu entries.
1514  It does not work currently because of a bug in the \SpecialChar LaTeX
1515  package 
1516 \series bold
1517 hyperref
1518 \series default
1519 .
1520 \end_layout
1521
1522 \end_inset
1523
1524
1525 \end_layout
1526
1527 \begin_layout Radio Box Style
1528
1529 print, borderstyle=I, radiosymbol=3
1530 \end_layout
1531
1532 \begin_layout Push Button Style
1533
1534 print, borderstyle=B, bordercolor=lime
1535 \end_layout
1536
1537 \begin_layout Submit Button Style
1538
1539 print, borderwidth=0, bordercolor=white
1540 \end_layout
1541
1542 \begin_layout Reset Button Style
1543
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
2398 pdfborder={0 0 0}
2399 \begin_inset Note Note
2400 status open
2401
2402 \begin_layout Plain Layout
2403 Sets the thickness of the predefined link border to zero as described below.
2404 \end_layout
2405
2406 \end_inset
2407
2408
2409 \end_layout
2410
2411 \begin_layout Standard
2412 To customize the border color, border thickness and the distance to the
2413  border one changes the border settings of the box.
2414  An example with a 4
2415 \begin_inset space \thinspace{}
2416 \end_inset
2417
2418 pt thick, teal border and 3
2419 \begin_inset space \thinspace{}
2420 \end_inset
2421
2422 pt border separation :
2423 \begin_inset VSpace defskip
2424 \end_inset
2425
2426
2427 \begin_inset Newline newline
2428 \end_inset
2429
2430
2431 \begin_inset Flex PDFAction
2432 status open
2433
2434 \begin_layout Plain Layout
2435 \begin_inset Argument 1
2436 status open
2437
2438 \begin_layout Plain Layout
2439 SaveAs
2440 \end_layout
2441
2442 \end_inset
2443
2444
2445 \begin_inset Box Boxed
2446 position "c"
2447 hor_pos "c"
2448 has_inner_box 1
2449 inner_pos "c"
2450 use_parbox 1
2451 use_makebox 0
2452 width "5cm"
2453 special "none"
2454 height "2in"
2455 height_special "totalheight"
2456 thickness "4pt"
2457 separation "3pt"
2458 shadowsize "4pt"
2459 framecolor "teal"
2460 backgroundcolor "white"
2461 status open
2462
2463 \begin_layout Plain Layout
2464 \noindent
2465 Save form as
2466 \end_layout
2467
2468 \end_inset
2469
2470
2471 \end_layout
2472
2473 \end_inset
2474
2475
2476 \end_layout
2477
2478 \begin_layout Standard
2479 To customize the border thickness, add the command 
2480 \series bold
2481 pdfborder={0 0 t}
2482 \series default
2483  to the additional options in the document settings under 
2484 \family sans
2485 PDF
2486 \begin_inset space ~
2487 \end_inset
2488
2489 properties
2490 \family default
2491  and replace 
2492 \series bold
2493 t
2494 \series default
2495  with a number that is the thickness in pixels.
2496  If you want to change the border thickness only for certain buttons, use
2497  the environment 
2498 \family sans
2499 PDF
2500 \begin_inset space ~
2501 \end_inset
2502
2503 link
2504 \begin_inset space ~
2505 \end_inset
2506
2507 setup
2508 \family default
2509  before the button and insert there the command 
2510 \series bold
2511 pdfborder
2512 \series default
2513 .
2514  The default value of 
2515 \series bold
2516 pdfborder
2517 \series default
2518  is 
2519 \series bold
2520 {0 0 1}
2521 \series default
2522 .
2523 \end_layout
2524
2525 \begin_layout Standard
2526 \begin_inset Note Greyedout
2527 status open
2528
2529 \begin_layout Plain Layout
2530
2531 \series bold
2532 Note:
2533 \series default
2534  
2535 \series bold
2536 pdfborder
2537 \series default
2538  affects all link types, not only the action links.
2539 \end_layout
2540
2541 \end_inset
2542
2543
2544 \end_layout
2545
2546 \begin_layout PDF Link Setup
2547
2548 pdfborder={0 0 4}
2549 \end_layout
2550
2551 \begin_layout Standard
2552 An example with a 4
2553 \begin_inset space ~
2554 \end_inset
2555
2556 pixel thick border:
2557 \begin_inset Newline newline
2558 \end_inset
2559
2560
2561 \begin_inset Flex PDFAction
2562 status open
2563
2564 \begin_layout Plain Layout
2565 \begin_inset Argument 1
2566 status open
2567
2568 \begin_layout Plain Layout
2569 SaveAs
2570 \end_layout
2571
2572 \end_inset
2573
2574
2575 \begin_inset Box Frameless
2576 position "c"
2577 hor_pos "c"
2578 has_inner_box 1
2579 inner_pos "c"
2580 use_parbox 1
2581 use_makebox 0
2582 width "5cm"
2583 special "none"
2584 height "2in"
2585 height_special "totalheight"
2586 thickness "0.4pt"
2587 separation "3pt"
2588 shadowsize "4pt"
2589 framecolor "black"
2590 backgroundcolor "none"
2591 status open
2592
2593 \begin_layout Plain Layout
2594 \noindent
2595 Save form as
2596 \end_layout
2597
2598 \end_inset
2599
2600
2601 \end_layout
2602
2603 \end_inset
2604
2605
2606 \end_layout
2607
2608 \begin_layout Standard
2609 To change the border color use the command 
2610 \series bold
2611 menubordercolor={r g b}
2612 \series default
2613  where 
2614 \series bold
2615 r
2616 \series default
2617
2618 \series bold
2619 g
2620 \series default
2621  and 
2622 \series bold
2623 b
2624 \series default
2625  are numbers between 0 and 1 for the colors red, green and blue.
2626  The default value of 
2627 \series bold
2628 menubordercolor
2629 \series default
2630  is 
2631 \series bold
2632 {1 0 0}
2633 \series default
2634 .
2635 \end_layout
2636
2637 \begin_layout PDF Link Setup
2638
2639 pdfborder={0 0 1}, menubordercolor={0.1 0.9 0.5}
2640 \end_layout
2641
2642 \begin_layout Standard
2643 An example with 
2644 \series bold
2645 menubordercolor={0.1 0.9 0.5}
2646 \series default
2647 :
2648 \begin_inset Newline newline
2649 \end_inset
2650
2651
2652 \begin_inset Flex PDFAction
2653 status open
2654
2655 \begin_layout Plain Layout
2656 \begin_inset Argument 1
2657 status open
2658
2659 \begin_layout Plain Layout
2660 SaveAs
2661 \end_layout
2662
2663 \end_inset
2664
2665
2666 \begin_inset Box Frameless
2667 position "c"
2668 hor_pos "c"
2669 has_inner_box 1
2670 inner_pos "c"
2671 use_parbox 1
2672 use_makebox 0
2673 width "5cm"
2674 special "none"
2675 height "2in"
2676 height_special "totalheight"
2677 thickness "0.4pt"
2678 separation "3pt"
2679 shadowsize "4pt"
2680 framecolor "black"
2681 backgroundcolor "none"
2682 status open
2683
2684 \begin_layout Plain Layout
2685 \noindent
2686 Save form as
2687 \end_layout
2688
2689 \end_inset
2690
2691
2692 \end_layout
2693
2694 \end_inset
2695
2696
2697 \end_layout
2698
2699 \begin_layout Standard
2700 To change the background color use a colored box.
2701 \end_layout
2702
2703 \begin_layout PDF Link Setup
2704
2705 pdfborder={0 0 0}
2706 \end_layout
2707
2708 \begin_layout Standard
2709 An example without a border and with lime background color:
2710 \begin_inset Newline newline
2711 \end_inset
2712
2713
2714 \begin_inset Flex PDFAction
2715 status open
2716
2717 \begin_layout Plain Layout
2718 \begin_inset Argument 1
2719 status open
2720
2721 \begin_layout Plain Layout
2722 SaveAs
2723 \end_layout
2724
2725 \end_inset
2726
2727
2728 \begin_inset Box Frameless
2729 position "c"
2730 hor_pos "c"
2731 has_inner_box 1
2732 inner_pos "c"
2733 use_parbox 1
2734 use_makebox 0
2735 width "5cm"
2736 special "none"
2737 height "2in"
2738 height_special "totalheight"
2739 thickness "0.4pt"
2740 separation "3pt"
2741 shadowsize "4pt"
2742 framecolor "black"
2743 backgroundcolor "lime"
2744 status open
2745
2746 \begin_layout Plain Layout
2747 \noindent
2748 Save form as
2749 \end_layout
2750
2751 \end_inset
2752
2753
2754 \end_layout
2755
2756 \end_inset
2757
2758
2759 \end_layout
2760
2761 \begin_layout PDF Link Setup
2762
2763 pdfborder={0 0 1}, menubordercolor={1 0 0}
2764 \end_layout
2765
2766 \begin_layout Section
2767 Dynamic form elements
2768 \end_layout
2769
2770 \begin_layout Standard
2771 It is also possible to have dynamic form elements.
2772  This means that depending on the actions of the user elements can (dis)appear
2773  or change their appearance.
2774  To use this feature, add these lines to your LaTeX preamble:
2775 \end_layout
2776
2777 \begin_layout Standard
2778
2779 \series bold
2780
2781 \backslash
2782 usepackage[pdftex]{insdljs}
2783 \begin_inset Newline newline
2784 \end_inset
2785
2786
2787 \backslash
2788 pdfcatalog{/AA 
2789 \backslash
2790 the
2791 \backslash
2792 pdflastobj
2793 \backslash
2794 space 0 R}
2795 \end_layout
2796
2797 \begin_layout Standard
2798 Then add the necessary JavaScript code to your document LaTeX preamble or
2799  as \SpecialChar TeX
2800  code to your document.
2801  For info about JavaScript, see its documentation, 
2802 \begin_inset CommandInset citation
2803 LatexCommand cite
2804 key "JavaScript"
2805 literal "true"
2806
2807 \end_inset
2808
2809 .
2810 \end_layout
2811
2812 \begin_layout Standard
2813 \begin_inset ERT
2814 status collapsed
2815
2816 \begin_layout Plain Layout
2817
2818
2819 \backslash
2820 ifinsdljs
2821 \end_layout
2822
2823 \end_inset
2824
2825
2826 \begin_inset Note Note
2827 status open
2828
2829 \begin_layout Plain Layout
2830 The following section will only be displayed when the \SpecialChar LaTeX
2831  package 
2832 \series bold
2833 insdljs
2834 \series default
2835  is installed.
2836 \end_layout
2837
2838 \end_inset
2839
2840
2841 \end_layout
2842
2843 \begin_layout Standard
2844 For the following choice menu this JavaScript code was used:
2845 \end_layout
2846
2847 \begin_layout Standard
2848 \begin_inset listings
2849 lstparams "language=TeX"
2850 inline false
2851 status open
2852
2853 \begin_layout Plain Layout
2854
2855
2856 \backslash
2857 begin{insDLJS}[exaaae]{exaaae}{JavaScript}
2858 \end_layout
2859
2860 \begin_layout Plain Layout
2861
2862  function validateTime(){
2863 \end_layout
2864
2865 \begin_layout Plain Layout
2866
2867   this.delay = true;
2868 \end_layout
2869
2870 \begin_layout Plain Layout
2871
2872   if((event.value == "u") || (event.value == "unlimited")) {
2873 \end_layout
2874
2875 \begin_layout Plain Layout
2876
2877    this.getField("from").display = display.hidden;
2878 \end_layout
2879
2880 \begin_layout Plain Layout
2881
2882    this.getField("until").display = display.hidden;
2883 \end_layout
2884
2885 \begin_layout Plain Layout
2886
2887   } else {
2888 \end_layout
2889
2890 \begin_layout Plain Layout
2891
2892    this.getField("from").display = display.visible;
2893 \end_layout
2894
2895 \begin_layout Plain Layout
2896
2897    this.getField("until").display = display.visible;
2898 \end_layout
2899
2900 \begin_layout Plain Layout
2901
2902    this.getField("from").setFocus();
2903 \end_layout
2904
2905 \begin_layout Plain Layout
2906
2907   }
2908 \end_layout
2909
2910 \begin_layout Plain Layout
2911
2912   this.delay = false;
2913 \end_layout
2914
2915 \begin_layout Plain Layout
2916
2917  }
2918 \end_layout
2919
2920 \begin_layout Plain Layout
2921
2922
2923 \backslash
2924 end{insDLJS}
2925 \end_layout
2926
2927 \end_inset
2928
2929
2930 \end_layout
2931
2932 \begin_layout Standard
2933 \begin_inset Note Greyedout
2934 status open
2935
2936 \begin_layout Plain Layout
2937
2938 \series bold
2939 Note:
2940 \series default
2941  
2942 \emph on
2943 All
2944 \emph default
2945  JavaScript functions must be inserted into the same 
2946 \family sans
2947 insDLJS
2948 \family default
2949  environment.
2950 \end_layout
2951
2952 \end_inset
2953
2954
2955 \end_layout
2956
2957 \begin_layout Standard
2958 The 
2959 \family sans
2960 Parameters
2961 \family default
2962  of the following choice menu are
2963 \begin_inset Newline newline
2964 \end_inset
2965
2966
2967 \series bold
2968 name=contract,radio,default=tl,validate={validateTime();}
2969 \end_layout
2970
2971 \begin_layout Standard
2972 \begin_inset Flex ChoiceMenu
2973 status open
2974
2975 \begin_layout Plain Layout
2976 \begin_inset Argument 1
2977 status open
2978
2979 \begin_layout Plain Layout
2980 name=contract,radio,default=tl,validate={validateTime();}
2981 \end_layout
2982
2983 \end_inset
2984
2985 term-limited=tl, unlimited=u
2986 \begin_inset Argument 2
2987 status open
2988
2989 \begin_layout Plain Layout
2990 Job contract:
2991 \end_layout
2992
2993 \end_inset
2994
2995
2996 \end_layout
2997
2998 \end_inset
2999
3000
3001 \begin_inset VSpace defskip
3002 \end_inset
3003
3004
3005 \end_layout
3006
3007 \begin_layout Standard
3008 \begin_inset Tabular
3009 <lyxtabular version="3" rows="3" columns="2">
3010 <features tabularvalignment="middle">
3011 <column alignment="left" valignment="top">
3012 <column alignment="center" valignment="top">
3013 <row>
3014 <cell alignment="left" valignment="top" usebox="none">
3015 \begin_inset Text
3016
3017 \begin_layout Plain Layout
3018 From:
3019 \end_layout
3020
3021 \end_inset
3022 </cell>
3023 <cell alignment="center" valignment="top" usebox="none">
3024 \begin_inset Text
3025
3026 \begin_layout Plain Layout
3027 \begin_inset Flex TextField
3028 status open
3029
3030 \begin_layout Plain Layout
3031 \begin_inset Argument 1
3032 status open
3033
3034 \begin_layout Plain Layout
3035 name=from,width=10em
3036 \end_layout
3037
3038 \end_inset
3039
3040
3041 \end_layout
3042
3043 \end_inset
3044
3045
3046 \end_layout
3047
3048 \end_inset
3049 </cell>
3050 </row>
3051 <row>
3052 <cell alignment="center" valignment="top" usebox="none">
3053 \begin_inset Text
3054
3055 \begin_layout Plain Layout
3056
3057 \end_layout
3058
3059 \end_inset
3060 </cell>
3061 <cell alignment="center" valignment="top" usebox="none">
3062 \begin_inset Text
3063
3064 \begin_layout Plain Layout
3065 \begin_inset VSpace -1.5mm
3066 \end_inset
3067
3068
3069 \end_layout
3070
3071 \end_inset
3072 </cell>
3073 </row>
3074 <row>
3075 <cell alignment="left" valignment="top" usebox="none">
3076 \begin_inset Text
3077
3078 \begin_layout Plain Layout
3079 Until:
3080 \end_layout
3081
3082 \end_inset
3083 </cell>
3084 <cell alignment="center" valignment="top" usebox="none">
3085 \begin_inset Text
3086
3087 \begin_layout Plain Layout
3088 \begin_inset Flex TextField
3089 status open
3090
3091 \begin_layout Plain Layout
3092 \begin_inset Argument 1
3093 status open
3094
3095 \begin_layout Plain Layout
3096 name=until,width=10em
3097 \end_layout
3098
3099 \end_inset
3100
3101
3102 \end_layout
3103
3104 \end_inset
3105
3106
3107 \end_layout
3108
3109 \end_inset
3110 </cell>
3111 </row>
3112 </lyxtabular>
3113
3114 \end_inset
3115
3116
3117 \end_layout
3118
3119 \begin_layout Standard
3120 \begin_inset VSpace bigskip
3121 \end_inset
3122
3123
3124 \end_layout
3125
3126 \begin_layout Standard
3127 To check and assure that the user only enters a number to a text field you
3128  can for example use this JavaScript code:
3129 \end_layout
3130
3131 \begin_layout Standard
3132 \begin_inset listings
3133 lstparams "language=TeX"
3134 inline false
3135 status open
3136
3137 \begin_layout Plain Layout
3138
3139 function checkNumber() {
3140 \end_layout
3141
3142 \begin_layout Plain Layout
3143
3144  event.rc = true;
3145 \end_layout
3146
3147 \begin_layout Plain Layout
3148
3149  if (!Number(event.value)) {
3150 \end_layout
3151
3152 \begin_layout Plain Layout
3153
3154   app.alert("Value must be a number!");
3155 \end_layout
3156
3157 \begin_layout Plain Layout
3158
3159   event.value = "";
3160 \end_layout
3161
3162 \begin_layout Plain Layout
3163
3164  } else {
3165 \end_layout
3166
3167 \begin_layout Plain Layout
3168
3169   event.target.textColor = color.green;
3170 \end_layout
3171
3172 \begin_layout Plain Layout
3173
3174 }
3175 \end_layout
3176
3177 \end_inset
3178
3179
3180 \end_layout
3181
3182 \begin_layout Standard
3183 An example text field: 
3184 \begin_inset Flex TextField
3185 status open
3186
3187 \begin_layout Plain Layout
3188 \begin_inset Argument 1
3189 status open
3190
3191 \begin_layout Plain Layout
3192 name=onlyNumbers, align=1, validate={checkNumber();}
3193 \end_layout
3194
3195 \end_inset
3196
3197
3198 \end_layout
3199
3200 \end_inset
3201
3202
3203 \end_layout
3204
3205 \begin_layout Standard
3206 \begin_inset ERT
3207 status collapsed
3208
3209 \begin_layout Plain Layout
3210
3211
3212 \backslash
3213 else
3214 \end_layout
3215
3216 \end_inset
3217
3218
3219 \begin_inset Note Note
3220 status open
3221
3222 \begin_layout Plain Layout
3223 The following will be displayed when the \SpecialChar LaTeX
3224  package 
3225 \series bold
3226 insdljs
3227 \series default
3228  is not installed:
3229 \end_layout
3230
3231 \end_inset
3232
3233
3234 \end_layout
3235
3236 \begin_layout Standard
3237 You need to install the package 
3238 \series bold
3239 insdljs
3240 \series default
3241  to see the content of this section in the output.
3242 \end_layout
3243
3244 \begin_layout Standard
3245 \begin_inset ERT
3246 status collapsed
3247
3248 \begin_layout Plain Layout
3249
3250
3251 \backslash
3252 fi
3253 \end_layout
3254
3255 \end_inset
3256
3257
3258 \end_layout
3259
3260 \begin_layout End PDF Form
3261
3262 \begin_inset Note Note
3263 status open
3264
3265 \begin_layout Plain Layout
3266 keep this empty
3267 \end_layout
3268
3269 \end_inset
3270
3271
3272 \end_layout
3273
3274 \begin_layout Section
3275 General notes
3276 \end_layout
3277
3278 \begin_layout Itemize
3279 Submitting and applying data requires that all form elements have a name.
3280 \end_layout
3281
3282 \begin_layout Itemize
3283 Creating a PDF form requires pdf\SpecialChar TeX
3284  or Lua\SpecialChar TeX
3285 .
3286  Use therefore either the \SpecialChar LyX
3287  export formats 
3288 \family sans
3289 PDF (pdflatex)
3290 \family default
3291  or 
3292 \family sans
3293 PDF (LuaTeX)
3294 \family default
3295 .
3296 \end_layout
3297
3298 \begin_layout Itemize
3299 To see in 
3300 \emph on
3301 Adobe Reader
3302 \emph default
3303  and 
3304 \emph on
3305 Acrobat
3306 \emph default
3307  custom background colors you must disable in these programs the highlighting
3308  of form fields.
3309  (Option 
3310 \begin_inset Quotes eld
3311 \end_inset
3312
3313 Show border hover color for fields
3314 \begin_inset Quotes erd
3315 \end_inset
3316
3317 )
3318 \end_layout
3319
3320 \begin_layout Bibliography
3321 \begin_inset CommandInset bibitem
3322 LatexCommand bibitem
3323 key "JavaScript"
3324 literal "true"
3325
3326 \end_inset
3327
3328
3329 \begin_inset CommandInset href
3330 LatexCommand href
3331 name "JavaScript reference"
3332 target "https://developer.mozilla.org/en/docs/Web/JavaScript/Reference"
3333 literal "false"
3334
3335 \end_inset
3336
3337
3338 \end_layout
3339
3340 \begin_layout Bibliography
3341 \begin_inset CommandInset bibitem
3342 LatexCommand bibitem
3343 key "hyperref"
3344 literal "true"
3345
3346 \end_inset
3347
3348
3349 \begin_inset CommandInset href
3350 LatexCommand href
3351 name "Documentation"
3352 target "http://mirrors.ctan.org/macros/latex/contrib/hyperref/doc/manual.pdf"
3353 literal "false"
3354
3355 \end_inset
3356
3357  of the \SpecialChar LaTeX
3358  package 
3359 \series bold
3360 hyperref
3361 \end_layout
3362
3363 \begin_layout Bibliography
3364 \begin_inset CommandInset bibitem
3365 LatexCommand bibitem
3366 key "pifont"
3367 literal "true"
3368
3369 \end_inset
3370
3371
3372 \begin_inset CommandInset href
3373 LatexCommand href
3374 name "Documentation"
3375 target "http://mirrors.ctan.org/macros/latex/required/psnfss/psnfss2e.pdf"
3376 literal "false"
3377
3378 \end_inset
3379
3380  of the \SpecialChar LaTeX
3381  package 
3382 \series bold
3383 pifont
3384 \end_layout
3385
3386 \end_body
3387 \end_document