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