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