X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=lib%2Fexamples%2FPDF-form.lyx;h=c6438704a263173296145a5eb2c3bd766aeecdbc;hb=3e7dee32edeb1cf3cd72be56cf021d3a64fc235c;hp=c20bf7778432c062d6da44799bc4f9119e2909b5;hpb=36a5f46c0d13fd887d306d1c2cb95646c71561dc;p=lyx.git diff --git a/lib/examples/PDF-form.lyx b/lib/examples/PDF-form.lyx index c20bf77784..c6438704a2 100644 --- a/lib/examples/PDF-form.lyx +++ b/lib/examples/PDF-form.lyx @@ -1,13 +1,11 @@ -#LyX 2.1 created this file. For more info see http://www.lyx.org/ -\lyxformat 474 +#LyX 2.2 created this file. For more info see http://www.lyx.org/ +\lyxformat 508 \begin_document \begin_header +\save_transient_properties true +\origin /systemlyxdir/examples/ \textclass scrartcl \begin_preamble -% to be able to use custom colors -\usepackage[svgnames,rgb]{xcolor} - -% ------------------------------------ % used to check for needed LaTeX packages \usepackage{ifthen} @@ -20,20 +18,39 @@ {\setboolean{insdljs}{false}} \pdfcatalog{/AA \the\pdflastobj\space 0 R} -\begin{insDLJS}[exaaae]{exaaae}{JavaScript} + +\ifinsdljs % only execute if package insdljs is installed + + \begin{insDLJS}[exaaae]{exaaae}{JavaScript} + function validateTime(){ this.delay = true; if((event.value == "u") || (event.value == "unlimited")) { - this.getField("from").display = display.hidden; - this.getField("to").display = display.hidden; - } else { - this.getField("from").display = display.visible; - this.getField("to").display = display.visible; - this.getField("from").setFocus(); - } - this.delay = false; + this.getField("from").display = display.hidden; + this.getField("to").display = display.hidden; + } else { + this.getField("from").display = display.visible; + this.getField("to").display = display.visible; + this.getField("from").setFocus(); + } + this.delay = false; } -\end{insDLJS} + + function checkNumber() { + event.rc = true; + if (!Number(event.value)) + { + app.alert("Value must be a number!"); + event.value = ""; + } else { + event.target.textColor = color.green; + } + +} + + \end{insDLJS} + +\fi % end \ifinsdljs % if pdflatex is used \usepackage{ifpdf} @@ -55,18 +72,18 @@ pdfform \language_package default \inputencoding auto \fontencoding global -\font_roman default -\font_sans default -\font_typewriter default -\font_math auto +\font_roman "default" "default" +\font_sans "default" "default" +\font_typewriter "default" "default" +\font_math "auto" "auto" \font_default_family default \use_non_tex_fonts false \font_sc false \font_osf false -\font_sf_scale 100 -\font_tt_scale 100 +\font_sf_scale 100 100 +\font_tt_scale 100 100 \graphics default -\default_output_format default +\default_output_format pdf2 \output_sync 0 \bibtex_command bibtex \index_command default @@ -156,7 +173,8 @@ Uwe Stöhr status open \begin_layout Plain Layout -To export all parts of this document to PDF the LaTeX-package +To export all parts of this document to PDF the \SpecialChar LaTeX +-package \series bold insdljs \series default @@ -209,7 +227,8 @@ PDF Form \family default - from LyX's dropdown menu at the beginning of the document. + from \SpecialChar LyX +'s dropdown menu at the beginning of the document. If only a part of the document should be a form, add \family sans Begin @@ -244,7 +263,7 @@ Note: \begin_layout Standard If the form data should be submitted to a server or the like, then you must - specify the URL to where it should be submitted as parameter of the + specify the URL as parameter of the \family sans Begin \begin_inset space ~ @@ -259,7 +278,7 @@ Form environment. This is done by using the menu \family sans -Insert\SpecialChar \menuseparator +Insert\SpecialChar menuseparator PDF \begin_inset space ~ \end_inset @@ -290,8 +309,8 @@ This sends the form data as email to \emph on forms@lyx.test \emph default -. - The email subject is + when the user presses the submit button. + The email subject will be \begin_inset Quotes eld \end_inset @@ -308,7 +327,18 @@ post \series bold get \series default -.) +.) For more about submitting see sec. +\begin_inset space \thinspace{} +\end_inset + + +\begin_inset CommandInset ref +LatexCommand ref +reference "subsec:Submit-button" + +\end_inset + +. \end_layout \begin_layout Standard @@ -341,7 +371,7 @@ TextField \family default using the menu \family sans -Insert\SpecialChar \menuseparator +Insert\SpecialChar menuseparator Custom \begin_inset space ~ \end_inset @@ -360,7 +390,6 @@ Insets status open \begin_layout Plain Layout - \begin_inset Argument 1 status open @@ -380,20 +409,11 @@ Enter your name here: \begin_layout Standard You must also specify a field name for text fields: Set the cursor into - the inset and use the menu + its \family sans -Insert\SpecialChar \menuseparator -PDF -\begin_inset space ~ -\end_inset - -form -\begin_inset space ~ -\end_inset - -parameters +Params \family default -. + inset. There insert for example the parameter \series bold name=customer @@ -403,38 +423,63 @@ name=customer customer \series default is the field name). - Only if your text field has a label and no parameters the specification - of the name can be omitted. \end_layout \begin_layout Standard -All form fields can be customized by adding a parameter inset to them. - To do this, set the cursor into the field inset and use the menu -\family sans -Insert\SpecialChar \menuseparator -PDF -\begin_inset space ~ +Using the same name for several text fields results in an automatic duplication + of the inserted text. + This is for example useful if the user should input a date that should + appear at different places in the form. +\begin_inset Newline newline \end_inset -form +Here are 2 \begin_inset space ~ \end_inset -parameters -\family default -. +fields as example: Fill one and see that the other one will also be filled + automatically: +\begin_inset Newline newline +\end_inset + + +\begin_inset Flex TextField +status open + +\begin_layout Plain Layout +\begin_inset Argument 1 +status open + +\begin_layout Plain Layout +name=identic \end_layout -\begin_layout Standard -\begin_inset Note Greyedout +\end_inset + + +\end_layout + +\end_inset + + +\begin_inset Newline newline +\end_inset + + +\begin_inset Flex TextField status open \begin_layout Plain Layout +\begin_inset Argument 1 +status open + +\begin_layout Plain Layout +name=identic +\end_layout + +\end_inset + -\series bold -Note: -\series default - All braces and brackets in form parameters must be inserted as TeX code! \end_layout \end_inset @@ -443,11 +488,19 @@ Note: \end_layout \begin_layout Standard -Here is a customized multiline text field with a width of 5 +All form fields can be customized by adding parameters. +\end_layout + +\begin_layout Standard +Here is a customized multiline text field with a width of 60 +\begin_inset space \thinspace{} +\end_inset + +% of the text width, 3 \begin_inset space \thinspace{} \end_inset -cm and a proposed content: +cm height and a proposed content: \begin_inset VSpace defskip \end_inset @@ -460,12 +513,11 @@ cm and a proposed content: status open \begin_layout Plain Layout - \begin_inset Argument 1 status open \begin_layout Plain Layout -name=customer2, width=5cm, multiline, width=0.6 +name=customer2, multiline, width=0.6 \backslash textwidth, height=3cm, value={Testman} \end_layout @@ -530,7 +582,6 @@ CheckBox status open \begin_layout Plain Layout - \begin_inset Argument 1 status open @@ -549,22 +600,8 @@ Are you older than 18 years? \end_layout \begin_layout Standard -You must also specify a field name for check boxes: Set the cursor into - the inset and use the menu -\family sans -Insert\SpecialChar \menuseparator -PDF -\begin_inset space ~ -\end_inset - -form -\begin_inset space ~ -\end_inset - -parameters -\family default -. - There insert for example the parameter +You must also specify a field name for check boxes: Insert for example the + parameter \series bold name=age \series default @@ -572,9 +609,11 @@ name=age \series bold age \series default - is the field name). - Only if your check box has a label and no parameters the specification - of the name can be omitted. + is the field name) into the +\family sans +Params +\family default + inset. \end_layout \begin_layout Subsection @@ -587,12 +626,17 @@ A choice menu is added by inserting the custom inset ChoiceMenu \family default . - The label is inserted into the + A label for the inset is added by using the menu \family sans +Insert\SpecialChar menuseparator Label \family default - inset. - The choices are inserted to the inset as comma-separated list. +. + Insert the label text into this inset. +\begin_inset Newline newline +\end_inset + +The different choices are inserted to the inset as comma-separated list. There are 3 \begin_inset space ~ \end_inset @@ -616,22 +660,7 @@ Popdown All choices are listed below each other. \end_layout \begin_layout Standard -To determine the choice menu type, set the cursor into the inset and use - the menu -\family sans -Insert\SpecialChar \menuseparator -PDF -\begin_inset space ~ -\end_inset - -form -\begin_inset space ~ -\end_inset - -parameters -\family default -. - There insert the parameter +To determine the choice menu type, add the parameter \series bold radio \series default @@ -648,6 +677,10 @@ popdown \begin_layout Standard Here is an example for the radio type: +\begin_inset VSpace defskip +\end_inset + + \begin_inset Newline newline \end_inset @@ -656,12 +689,11 @@ Here is an example for the radio type: status open \begin_layout Plain Layout - \begin_inset Argument 1 status open \begin_layout Plain Layout -radio +radio, name=radio \end_layout \end_inset @@ -686,6 +718,10 @@ Sex: \begin_layout Standard Here is an example for the combo type: +\begin_inset VSpace defskip +\end_inset + + \begin_inset Newline newline \end_inset @@ -694,12 +730,11 @@ Here is an example for the combo type: status open \begin_layout Plain Layout - \begin_inset Argument 1 status open \begin_layout Plain Layout -combo +combo, name=combo \end_layout \end_inset @@ -724,6 +759,10 @@ Country: \begin_layout Standard Here is an example for the popdown type: +\begin_inset VSpace defskip +\end_inset + + \begin_inset Newline newline \end_inset @@ -732,7 +771,6 @@ Here is an example for the popdown type: status open \begin_layout Plain Layout - \begin_inset Argument 1 status open @@ -761,27 +799,8 @@ Country: \end_layout \begin_layout Standard -\begin_inset Note Greyedout -status open - -\begin_layout Plain Layout - -\series bold -Note: -\series default - For the popdown type you must always specify a field name: Add to the -\family sans -PDF -\begin_inset space ~ -\end_inset - -form -\begin_inset space ~ -\end_inset - -parameters -\family default - for example the parameter +You must also specify a field name for choice menus: Insert for example + the parameter \series bold name=country \series default @@ -789,18 +808,17 @@ name=country \series bold country \series default - is the field name). -\end_layout - -\end_inset - - + is the field name) into the +\family sans +Params +\family default + inset. \end_layout \begin_layout Standard It is recommended to add a short name for every choice to be able to access - them and to know which one was chosen by the user- This is done by adding - + them and to know which one was chosen by the user. + This is done by adding \series bold =name \series default @@ -856,7 +874,6 @@ default=m status open \begin_layout Plain Layout - \begin_inset Argument 1 status open @@ -893,7 +910,8 @@ status open \series bold Note: \series default - Due to a bug in the LaTeX package + Due to a bug in the \SpecialChar LaTeX + package \series bold hyperref \series default @@ -905,57 +923,25 @@ hyperref \end_layout -\begin_layout Subsection -Push button -\end_layout - \begin_layout Standard -A push button is added by inserting the custom inset -\family sans -PushButton -\family default -. - Write inside the inset the label for the button. - Here is an example: -\begin_inset Newline newline +\begin_inset Newpage newpage \end_inset -\begin_inset Flex PushButton -status open - -\begin_layout Plain Layout - -Don't click on this button or your fridge will be destroyed!!! \end_layout -\end_inset - - +\begin_layout Subsection +Push button \end_layout \begin_layout Standard -The action that is triggered by pressing the button is specified by JavaScript - code. - To specify it, set the cursor into the inset and use the menu +A push button is added by inserting the custom inset \family sans -Insert\SpecialChar \menuseparator -PDF -\begin_inset space ~ -\end_inset - -form -\begin_inset space ~ -\end_inset - -parameters +PushButton \family default . - There insert the parameter -\series bold -onclick={} -\series default - and write the JavaScript code between the braces. + Write inside the inset the label for the button. + Here is an example: \end_layout \begin_layout Standard @@ -963,13 +949,11 @@ onclick={} status open \begin_layout Plain Layout - \begin_inset Argument 1 status open \begin_layout Plain Layout -onclick={app.alert("What the hell? Now you destroyed your fridge. - Congratulations.")} + \end_layout \end_inset @@ -983,7 +967,14 @@ Don't click on this button or your fridge will be destroyed!!! \end_layout \begin_layout Standard -For info about JavaScript, see its documentation, +The action that is triggered by pressing the button is specified by JavaScript + code. + To specify it, add the parameter +\series bold +onclick={} +\series default + and insert the JavaScript code between the braces. + For info about JavaScript, see its documentation, \begin_inset CommandInset citation LatexCommand cite key "JavaScript" @@ -991,44 +982,36 @@ key "JavaScript" \end_inset . -\end_layout - -\begin_layout Standard -A common usage for pus buttons is to open a weblink. - Such a button is created by inserting the command -\series bold - -\backslash -href -\series default - into the button inset. - -\series bold - -\backslash -href -\series default - is used in the scheme + In the following example this JavaScript code was used: \begin_inset Newline newline \end_inset \series bold +app.alert( +\begin_inset ERT +status collapsed -\backslash -href{link target}{text} +\begin_layout Plain Layout + +" \end_layout -\begin_layout Standard -In the following button this code was used: -\begin_inset Newline newline \end_inset +What the hell? Now you destroyed your fridge. + Congratulations. +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout -\series bold +" +\end_layout -\backslash -href{http://wiki.lyx.org}{Information how to fill out this form} +\end_inset + +) \end_layout \begin_layout Standard @@ -1036,10 +1019,93 @@ href{http://wiki.lyx.org}{Information how to fill out this form} status open \begin_layout Plain Layout +\begin_inset Argument 1 +status open + +\begin_layout Plain Layout +onclick={app.alert( +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout + +" +\end_layout + +\end_inset + +What the hell? Now you destroyed your fridge. + Congratulations. +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout + +" +\end_layout + +\end_inset + +)} +\end_layout + +\end_inset + +Don't click on this button or your fridge will be destroyed!!! +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Note Greyedout +status open + +\begin_layout Plain Layout + +\series bold +Note: +\series default + All quote characters in form parameters must be inserted as \SpecialChar TeX + code! +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +A common usage for pus buttons is to open a weblink. + Such a button is created by inserting a hyperlink into the button inset. + Here is an example: +\end_layout + +\begin_layout Standard +\begin_inset Flex PushButton +status open + +\begin_layout Plain Layout +\begin_inset Argument 1 +status open + +\begin_layout Plain Layout + +\end_layout + +\end_inset + + +\begin_inset CommandInset href +LatexCommand href +name "Information how to fill out this form" +target "http://wiki.lyx.org" + +\end_inset + - -\backslash -href{http://wiki.lyx.org}{Information how to fill out this form} \end_layout \end_inset @@ -1073,6 +1139,13 @@ if your push button border color is red (the default), otherwise use the \begin_layout Subsection Submit button +\begin_inset CommandInset label +LatexCommand label +name "subsec:Submit-button" + +\end_inset + + \end_layout \begin_layout Standard @@ -1084,15 +1157,13 @@ SubmitButton . Write inside the inset the label for the button. Here is an example: -\begin_inset Newline newline -\end_inset - +\end_layout +\begin_layout Standard \begin_inset Flex SubmitButton status open \begin_layout Plain Layout - \begin_inset Argument 1 status open @@ -1110,6 +1181,14 @@ Send your data via email \end_layout +\begin_layout Standard +The submit button creates a forms data format (FDF) file (file extension + *.fdf) which is then submitted. + The FDF file contains only the form data. + They can only be applied to a PDF form if all fields in the form have a + name. +\end_layout + \begin_layout Standard \begin_inset Note Greyedout status open @@ -1132,7 +1211,8 @@ reference "sec:Preparation" \end_inset for the description. - If there are no specifications you will get LaTeX errors! + If there are no specifications you will get \SpecialChar LaTeX + errors! \end_layout \end_inset @@ -1150,7 +1230,8 @@ status open Note: \series default If you have more than one submit button in your document you must specify - a name for each of them to avoid LaTeX errors! For example write + a name for each of them to avoid \SpecialChar LaTeX + errors! For example add \series bold name=submit1 \series default @@ -1179,15 +1260,13 @@ ResetButton . Write inside the inset the label for the button. Here is an example: -\begin_inset Newline newline -\end_inset - +\end_layout +\begin_layout Standard \begin_inset Flex ResetButton status open \begin_layout Plain Layout - \begin_inset Argument 1 status open @@ -1215,13 +1294,14 @@ status open Note: \series default If you have more than one reset button in your document you must specify - a name for each of them to avoid LaTeX errors! For example write + a name for each of them to avoid \SpecialChar LaTeX + errors! For example add \series bold -name=submit1 +name=reset1 \series default (where \series bold -submit1 +reset1 \series default is the button name). \end_layout @@ -1373,7 +1453,8 @@ Forms optional parameters \begin_inset Quotes erd \end_inset - of the documentation of the LaTeX package + of the documentation of the \SpecialChar LaTeX + package \series bold hyperref \series default @@ -1395,7 +1476,7 @@ Here are some examples: \end_layout \begin_layout Text Field Style -print, bordercolor=red,borderstyle=U, backgroundcolor=lightgray, color=lime, +print, bordercolor=red, borderstyle=U, backgroundcolor=lightgray, color=lime, maxlen=10, align=2, charsize=16pt \end_layout @@ -1451,8 +1532,16 @@ characters to insert: \begin_inset Flex TextField status open +\begin_layout Plain Layout +\begin_inset Argument 1 +status open + \begin_layout Plain Layout +\end_layout + +\end_inset + Enter your name here: \end_layout @@ -1529,8 +1618,16 @@ ding{55}: \begin_inset Flex CheckBox status open +\begin_layout Plain Layout +\begin_inset Argument 1 +status open + \begin_layout Plain Layout +\end_layout + +\end_inset + Are you older than 18 years? \end_layout @@ -1586,12 +1683,11 @@ Combo box with dashed, colored border: status open \begin_layout Plain Layout - \begin_inset Argument 1 status open \begin_layout Plain Layout -combo, default=Az +combo, name=combo2, default=Az \end_layout \end_inset @@ -1632,7 +1728,6 @@ entries are shown and where the last entry is preselected: status open \begin_layout Plain Layout - \begin_inset Argument 1 status open @@ -1711,12 +1806,11 @@ Radio box with inverted bevel border and symbol number status open \begin_layout Plain Layout - \begin_inset Argument 1 status open \begin_layout Plain Layout -radio +radio, name=radio2 \end_layout \end_inset @@ -1753,21 +1847,65 @@ Push button with a bevel border and colored text: status open \begin_layout Plain Layout - \begin_inset Argument 1 status open \begin_layout Plain Layout -onclick={app.alert("Why do you click this?")} +onclick={app.alert( +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout + +" +\end_layout + +\end_inset + +Why do you click this? +\begin_inset ERT +status collapsed + +\begin_layout Plain Layout + +" +\end_layout + +\end_inset + +)} +\end_layout + +\end_inset + + +\begin_inset Box Frameless +position "t" +hor_pos "c" +has_inner_box 1 +inner_pos "t" +use_parbox 0 +use_makebox 1 +width "" +special "none" +height "1in" +height_special "totalheight" +thickness "0.4pt" +separation "3pt" +shadowsize "4pt" +framecolor "black" +backgroundcolor "lime" +status open + +\begin_layout Plain Layout + +\color red +Don't click on this button!!! \end_layout \end_inset -\backslash -colorbox{lime}{ -\backslash -textcolor{red}{Don't click on this button!!!}} \end_layout \end_inset @@ -1805,59 +1943,7 @@ backgroundcolor \end_layout \begin_layout Standard -As workaround use the command -\series bold - -\backslash -colorbox -\series default - as described in sec. -\begin_inset space \thinspace{} -\end_inset - - 5.7 -\begin_inset Quotes eld -\end_inset - -Colored Boxes -\begin_inset Quotes erd -\end_inset - - in LyX's -\emph on -EmbeddedObjects -\emph default - manual and -\series bold - -\backslash -textcolor -\series default - that is used is used in the scheme -\begin_inset Newline newline -\end_inset - - -\series bold - -\backslash -textcolor{color}{characters to color} -\series default - -\begin_inset Newline newline -\end_inset - -In the button above this code was used: -\begin_inset Newline newline -\end_inset - - -\family sans - -\backslash -colorbox{lime}{ -\backslash -textcolor{red}{Don't click on this button!!!}} +As workaround use a colored box and/or color the box text. \end_layout \begin_layout Standard @@ -1886,18 +1972,7 @@ width \end_layout \begin_layout Standard -As workaround use the box method described in sec. -\begin_inset space \thinspace{} -\end_inset - - -\begin_inset CommandInset ref -LatexCommand ref -reference "sub:Action-button-customization" - -\end_inset - - +As workaround a box. \end_layout \begin_layout Itemize @@ -1914,7 +1989,6 @@ Submit button without border, with cyan background color and increased height: status open \begin_layout Plain Layout - \begin_inset Argument 1 status open @@ -1925,14 +1999,31 @@ name=submit2 \end_inset -\backslash -colorbox{cyan}{ -\backslash -parbox[c][4 -\backslash -totalheight]{5cm}{ -\backslash -centering Send your data via mail}} +\begin_inset Box Frameless +position "c" +hor_pos "c" +has_inner_box 1 +inner_pos "c" +use_parbox 1 +use_makebox 0 +width "5cm" +special "none" +height "4in" +height_special "totalheight" +thickness "0.4pt" +separation "3pt" +shadowsize "4pt" +framecolor "black" +backgroundcolor "cyan" +status open + +\begin_layout Plain Layout +Send your data via mail +\end_layout + +\end_inset + + \end_layout \end_inset @@ -1962,7 +2053,6 @@ cm: status open \begin_layout Plain Layout - \begin_inset Argument 1 status open @@ -1973,8 +2063,31 @@ name=reset2 \end_inset -\backslash -makebox[7cm]{Reset the form} +\begin_inset Box Frameless +position "t" +hor_pos "c" +has_inner_box 1 +inner_pos "t" +use_parbox 0 +use_makebox 1 +width "7cm" +special "none" +height "1in" +height_special "totalheight" +thickness "0.4pt" +separation "3pt" +shadowsize "4pt" +framecolor "black" +backgroundcolor "none" +status open + +\begin_layout Plain Layout +Reset the form +\end_layout + +\end_inset + + \end_layout \end_inset @@ -2031,7 +2144,8 @@ Acrobat-specific behavior \begin_inset Quotes erd \end_inset - of the documentation of the LaTeX package + of the documentation of the \SpecialChar LaTeX + package \series bold hyperref \series default @@ -2055,7 +2169,6 @@ Printing: status open \begin_layout Plain Layout - \begin_inset Argument 1 status open @@ -2083,7 +2196,6 @@ as: status open \begin_layout Plain Layout - \begin_inset Argument 1 status open @@ -2115,7 +2227,6 @@ fullscreen: status open \begin_layout Plain Layout - \begin_inset Argument 1 status open @@ -2137,7 +2248,7 @@ View the form in fullscreen Action button customization \begin_inset CommandInset label LatexCommand label -name "sub:Action-button-customization" +name "subsec:Action-button-customization" \end_inset @@ -2145,56 +2256,22 @@ name "sub:Action-button-customization" \end_layout \begin_layout Standard -Customizing the action buttons requires some complicated LaTeX code because - things like the width, height and border separation cannot be specified - as button parameters. +Customizing the action buttons requires the usage of boxes because things + like the width, height and border separation cannot be specified as button + parameters. \end_layout \begin_layout Standard -The easiest way to customize the buttons is to fill it with a custom box: -\end_layout - -\begin_layout Enumerate -Create a normal LyX box of your choice -\end_layout - -\begin_layout Enumerate -Use the menu -\family sans -View\SpecialChar \menuseparator -Source -\begin_inset space ~ -\end_inset - -Pane -\family default - to show the source code window (if not already shown) -\end_layout - -\begin_layout Enumerate -set the cursor into the box and copy the corresponding LaTeX code from the - source window -\end_layout - -\begin_layout Enumerate -paste it t the content of the -\family sans -PDFAction -\family default - inset. -\end_layout - -\begin_layout Standard -For example the button should be 4 +The easiest way to customize the buttons is to fill it with a custom box. + For example the button should be 4 \begin_inset space \thinspace{} \end_inset cm wide and have the height of 2 lines. Then create this parbox: -\begin_inset Newline newline -\end_inset - +\end_layout +\begin_layout Standard \begin_inset Box Frameless position "c" hor_pos "c" @@ -2206,6 +2283,11 @@ width "4cm" special "none" height "2in" height_special "totalheight" +thickness "0.4pt" +separation "3pt" +shadowsize "4pt" +framecolor "black" +backgroundcolor "none" status open \begin_layout Plain Layout @@ -2216,17 +2298,14 @@ Save form as \end_inset -\begin_inset Newline newline -\end_inset +\end_layout -and copy its LaTeX code to the button +\begin_layout Standard +inside a \family sans PDFAction \family default inset. - To center the text in the button add -\backslash -centering right before the button text. This is the result: \end_layout @@ -2235,7 +2314,6 @@ centering right before the button text. status open \begin_layout Plain Layout - \begin_inset Argument 1 status open @@ -2246,12 +2324,31 @@ SaveAs \end_inset -\backslash -parbox[c][2 -\backslash -totalheight]{4cm}{ -\backslash -centering Save form as} +\begin_inset Box Frameless +position "c" +hor_pos "c" +has_inner_box 1 +inner_pos "c" +use_parbox 1 +use_makebox 0 +width "4cm" +special "none" +height "2in" +height_special "totalheight" +thickness "0.4pt" +separation "3pt" +shadowsize "4pt" +framecolor "black" +backgroundcolor "none" +status open + +\begin_layout Plain Layout +Save form as +\end_layout + +\end_inset + + \end_layout \end_inset @@ -2332,7 +2429,6 @@ menubordercolor={0.1 0.9 0.5} status open \begin_layout Plain Layout - \begin_inset Argument 1 status open @@ -2343,12 +2439,32 @@ SaveAs \end_inset -\backslash -parbox[c][2 -\backslash -totalheight]{4cm}{ -\backslash -centering Save form as} +\begin_inset Box Frameless +position "c" +hor_pos "c" +has_inner_box 1 +inner_pos "c" +use_parbox 1 +use_makebox 0 +width "4cm" +special "none" +height "2in" +height_special "totalheight" +thickness "0.4pt" +separation "3pt" +shadowsize "4pt" +framecolor "black" +backgroundcolor "none" +status open + +\begin_layout Plain Layout +\noindent +Save form as +\end_layout + +\end_inset + + \end_layout \end_inset @@ -2416,7 +2532,6 @@ pixel thick yellow border: status open \begin_layout Plain Layout - \begin_inset Argument 1 status open @@ -2427,12 +2542,27 @@ SaveAs \end_inset -\backslash -parbox[c][2 -\backslash -totalheight]{4cm}{ -\backslash -centering Save form as} +\begin_inset Box Frameless +position "c" +hor_pos "c" +has_inner_box 1 +inner_pos "c" +use_parbox 1 +use_makebox 0 +width "4cm" +special "none" +height "2in" +height_special "totalheight" +thickness "0.4pt" +separation "3pt" +shadowsize "4pt" +framecolor "black" +backgroundcolor "none" +status open + +\begin_layout Plain Layout +\noindent +Save form as \end_layout \end_inset @@ -2440,39 +2570,13 @@ centering Save form as} \end_layout -\begin_layout Standard -To change the background color insert the command -\series bold - -\backslash -colorbox{color}{ -\series default - at the beginning of the button inset and a -\series bold -} -\series default - at the end. - -\series bold -color -\series default - is hereby the name of the color as described in sec. -\begin_inset space \thinspace{} \end_inset -5.7 -\begin_inset Quotes eld -\end_inset -Colored Boxes -\begin_inset Quotes erd -\end_inset +\end_layout - of LyX's -\emph on -EmbeddedObjects -\emph default - manual. +\begin_layout Standard +To change the background color use a colored box. \end_layout \begin_layout PDF Link Setup @@ -2480,7 +2584,7 @@ pdfborder={0 0 0} \end_layout \begin_layout Standard -An example without a border and with a background color: +An example without a border and with lime background color: \begin_inset Newline newline \end_inset @@ -2489,7 +2593,6 @@ An example without a border and with a background color: status open \begin_layout Plain Layout - \begin_inset Argument 1 status open @@ -2500,14 +2603,32 @@ SaveAs \end_inset -\backslash -colorbox{lime}{ -\backslash -parbox[c][2 -\backslash -totalheight]{4cm}{ -\backslash -centering Save form as}} +\begin_inset Box Frameless +position "c" +hor_pos "c" +has_inner_box 1 +inner_pos "c" +use_parbox 1 +use_makebox 0 +width "4cm" +special "none" +height "2in" +height_special "totalheight" +thickness "0.4pt" +separation "3pt" +shadowsize "4pt" +framecolor "black" +backgroundcolor "lime" +status open + +\begin_layout Plain Layout +\noindent +Save form as +\end_layout + +\end_inset + + \end_layout \end_inset @@ -2551,8 +2672,10 @@ space 0 R} \end_layout \begin_layout Standard -Then add the necessary JavaScript code to your preamble or as TeX code to - your document. +Then add the necessary JavaScript code to your document \SpecialChar LaTeX + preamble or as + \SpecialChar TeX + code to your document. For info about JavaScript, see its documentation, \begin_inset CommandInset citation LatexCommand cite @@ -2581,7 +2704,8 @@ ifinsdljs status open \begin_layout Plain Layout -The following section will only be displayed when the LaTeX package +The following section will only be displayed when the \SpecialChar LaTeX + package \series bold insdljs \series default @@ -2680,6 +2804,31 @@ end{insDLJS} \end_inset +\end_layout + +\begin_layout Standard +\begin_inset Note Greyedout +status open + +\begin_layout Plain Layout + +\series bold +Note: +\series default + +\emph on +All +\emph default + JavaScript funtions must be inserted into the same +\family sans +insDLJS +\family default + environment. +\end_layout + +\end_inset + + \end_layout \begin_layout Standard @@ -2701,7 +2850,7 @@ parameters \series bold -name=contract,radio,value=tl,default=tl,validate={validateTime();} +name=contract,radio,default=tl,validate={validateTime();} \end_layout \begin_layout Standard @@ -2709,12 +2858,11 @@ name=contract,radio,value=tl,default=tl,validate={validateTime();} status open \begin_layout Plain Layout - \begin_inset Argument 1 status open \begin_layout Plain Layout -name=contract,radio,value=tl,default=tl,validate={validateTime();} +name=contract,radio,default=tl,validate={validateTime();} \end_layout \end_inset @@ -2744,7 +2892,7 @@ Job contract: \begin_layout Standard \begin_inset Tabular - + @@ -2765,7 +2913,6 @@ From: status open \begin_layout Plain Layout - \begin_inset Argument 1 status open @@ -2827,7 +2974,6 @@ To: status open \begin_layout Plain Layout - \begin_inset Argument 1 status open @@ -2853,6 +2999,92 @@ name=to,width=10em \end_inset +\end_layout + +\begin_layout Standard +\begin_inset VSpace bigskip +\end_inset + + +\end_layout + +\begin_layout Standard +To check and assure that the user only enters a number to a text field you + can for example use this JavaScript code: +\end_layout + +\begin_layout Standard +\begin_inset listings +lstparams "language=TeX" +inline false +status open + +\begin_layout Plain Layout + +function checkNumber() { +\end_layout + +\begin_layout Plain Layout + + event.rc = true; +\end_layout + +\begin_layout Plain Layout + + if (!Number(event.value)) { +\end_layout + +\begin_layout Plain Layout + + app.alert("Value must be a number!"); +\end_layout + +\begin_layout Plain Layout + + event.value = ""; +\end_layout + +\begin_layout Plain Layout + + } else { +\end_layout + +\begin_layout Plain Layout + + event.target.textColor = color.green; +\end_layout + +\begin_layout Plain Layout + +} +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +An example text field: +\begin_inset Flex TextField +status open + +\begin_layout Plain Layout +\begin_inset Argument 1 +status open + +\begin_layout Plain Layout +name=onlyNumbers, align=1, validate={checkNumber();} +\end_layout + +\end_inset + + +\end_layout + +\end_inset + + \end_layout \begin_layout Standard @@ -2873,7 +3105,8 @@ else status open \begin_layout Plain Layout -The following will be displayed when the LaTeX package +The following will be displayed when the \SpecialChar LaTeX + package \series bold insdljs \series default @@ -2923,28 +3156,32 @@ keep this emtpy \end_layout \begin_layout Section -General hints +General notes and hints \end_layout \begin_layout Itemize -All braces and brackets in form parameters must be inserted as TeX code! +Submitting and applying data requires that all form fields have a name. \end_layout \begin_layout Itemize -To be able to use all kinds of colors and color definitions you must load - the LaTeX package -\series bold -xcolor -\series default - in the document preamble this way: -\begin_inset Newline newline -\end_inset - - -\series bold +All braces, brackets, backslashes and quote characters in form parameters + must be inserted as \SpecialChar TeX + code! +\end_layout -\backslash -usepackage[svgnames,rgb]{xcolor} +\begin_layout Itemize +Creating a PDF form requires pdflatex or lualatex. + Use either the \SpecialChar LyX + export formats +\family sans +PDF (pdflatex) +\family default + or +\family sans +PDF (Lua\SpecialChar TeX +) +\family default +. \end_layout \begin_layout Itemize @@ -2993,11 +3230,10 @@ target "http://mirrors.ctan.org/macros/latex/contrib/hyperref/doc/manual.pdf" \end_inset - of the LaTeX package + of the \SpecialChar LaTeX + package \series bold hyperref -\series default -. \end_layout \begin_layout Bibliography @@ -3015,11 +3251,10 @@ target "http://mirrors.ctan.org/macros/latex/required/psnfss/psnfss2e.pdf" \end_inset - of the LaTeX package + of the \SpecialChar LaTeX + package \series bold pifont -\series default -. \end_layout \end_body