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