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