Changes

Jump to navigation Jump to search
1,504 bytes added ,  18:14, 8 June 2020
m
no edit summary
< [[VisualsPresentations]] | [[Basics|Text formatting]] | [[Interaction]] >
You can find more about interactive form elements in [http://www.pragma-ade.com/general/manuals/mwidget-s.pdf Widgets uncovered]. It’s written for MkII, but still mostly valid.
</texcode>
'''Beware''', in In some versions of MkIV there was a bug that the JS code is was only copied to the PDF if there is was a \goto referencing one of the defined functions!. Should be gone.
You can pass values to a JS function:
<texcode>
\starttext
 
\setupinteraction [state=start]
\startJSpreamble {EXAMPLE} used now
They’re meant for clozes (texts with gaps, like in questionnaires).
In MkIV (as of 2015-04-01) default values are always used verbatim, i.e. JS() doesn’t work.(Check: other bug is gone, maybe this also?)
Other fields you must first define and then use. That might look complicated, but you can use the same field several times, and the contents will automatically repeat themselves if you need the same content at several places, even on different pages.
</texcode>
orIf you use this command in MkIV, avoid using default validation with <tt>\setupfieldcategory[fillinfield][validate=]</tt>. The default validation removes the contents from field.
<context source=yes>
# setup class (default is inherited, but you can use a different one)
# content symbol, defined by {{cmd|definesymbol}}
 
===Setup for questionnaire===
 
If you need a lot of similar radiobuttons, like in a questionnaire where you answer every question with a range choice, a meta definition makes sense. Fortunately it’s quite easy:
 
<texcode>
\setupfield [ChoiceSetup][width=1em,height=1em,corner=00]
 
\definesymbol[X][X] % replace with dingbat symbol
 
\def\Choice#1{\definefield[#1:main][radio][ChoiceSetup][#1:1,#1:2,#1:3,#1:4,#1:5,#1:0][#1:0]%
\definesubfield [#1:1][][X]%
\definesubfield [#1:2][][X]%
\definesubfield [#1:3][][X]%
\definesubfield [#1:4][][X]%
\definesubfield [#1:5][][X]%
\definesubfield [#1:0][][X]%
\field[#1:1]\,\field[#1:2]\,\field[#1:3]\,\field[#1:4]\,\field[#1:5]\hskip1em\field[#1:0]}
 
\def\ChoiceTitle{\hfill$-$\hskip4em$+$\hskip1.25em?\ \strut\par}
 
\def\Question{\dosingleempty\doQuestion}
% We need the "optional" parameter as reference
\def\doQuestion[#1]#2{%
\iffirstargument
#2\dotfill\Choice{#1}\par
\else
#2\par
\fi
}
 
\starttext
 
\ChoiceTitle
\Question[q:ctx]{How much do you love \CONTEXT?}
\Question[q:lua]{How are your Lua skills?}
\Question[q:xml]{How often do you dream in XML?}
 
\stoptext
</texcode>
==Checkboxes==
* [[Midgard PC sheet]] (RPG character sheet with lots of text fields in tables)
 
[[Category:Interaction]]
[[Category:PDF]]

Navigation menu