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