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