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