Re: widget woes (input fields)

Jean-Pierre Delange via ntg-context <[email protected]> Mon, 25 May 2026 19:17:15 +0200
Newsgroups gmane.comp.tex.context
Message-ID <[email protected]>
Hi Jim,

This is probably not just a “you” problem. Radio buttons are among the 
least portable PDF form widgets. Text fields and check boxes often print 
correctly because their visible appearance is simpler, while radio 
buttons depend on the selected widget’s appearance stream being updated 
and honoured by the PDF viewer/printer. First thing to test: make sure 
the radio setup uses |option=printable|, and try the |framed| variant in 
the second optional argument of |\setupfield|, e.g. 
|\setupfield[MMradio][framed][option=printable,...]|.

If that still fails, the robust workaround is to avoid live radio 
widgets in the printable version: either flatten the PDF after filling 
it, or generate a non-interactive print version using ordinary ConTeXt 
symbols/frames instead of PDF form widgets. Your radio field is missing 
|option=printable|, while your line field has it. I would also define 
and place the hidden default button, because |checkedButton| is used as 
the initial value but is not defined as a subfield in the example. 
Finally, I would remove |background=screen| while testing print output. 
Radio buttons are fragile across PDF viewers because their printed state 
depends on the widget appearance streams being honoured by the 
viewer/printer.

Best//JP

A testable MWE might be this one :

\setupinteraction[state=start]

\starttext

\setupfield
   [setup_1]
   [reset, horizontal]
   [option=printable,
    frame=off,
    bottomframe=on,
    width=4in,
    height=1.2em,
    offset=-1pt,
    frameoffset=2pt]

\definefield[line_1][line][setup_1][][]

This is an input line: \field[line_1]

\blank

\setupfield
   [setup_2]
   [option=printable,
    width=1.2em,
    height=1.2em]

\definefield[check_2][check][setup_2][X,_][_]

Click this to see an “X” or check-mark: \field[check_2]

\blank

\setupfield
   [setup_3]
   [option=printable,
    width=1.2em,
    height=1.2em,
    frame=on]

\definefield
   [radio_3]
   [radio]
   [setup_3]
   [checkedButton,Aaa,Bbb,Ccc]
   [checkedButton]

\definesubfield[checkedButton][][circle]
\definesubfield[Aaa][][circle]
\definesubfield[Bbb][][circle]
\definesubfield[Ccc][][circle]

% Hidden default radio button:
\hbox to 0pt{\field[checkedButton]\hss}

Aaa \field[Aaa]
Bbb \field[Bbb]
Ccc \field[Ccc]

\stoptext


Le 25/05/2026 à 17:13, Jim via ntg-context a écrit :
> Hi all,
>
> I have attached a minimal non-working example .tex file and the resulting
> PDF.
>
> If I type something in the text input line, and/or click the check box,
> when I print the file (from a variety of web browsers and versions of
> Acrobat reader on Linux and windows) those show up in the printout (or the
> "print to file" file).
>
> However, if I select a radio button, while on screen the button is visibly
> selected, but in the printout (or "print to file" file) the button is not
> selected.
>
> I understand (possibly incorrectly) that these widgets are using PDF
> features which are a bit out toward the edge of the PDF galaxy, but in case
> it is a "me" problem I come to the list, cap in hand.
>
> Can anyone tell me how I can fix my example so that a selected radio
> button prints out visibly selected?
>
> [[
> This PDF causes my "evince" program to dump core.  Without the buttons
> evince is somewhat happier, in that it doesn't dump core.  I will wildly
> guess that these problem are somehow related.
> ]]
>
> (In case you are wondering... I created a fourth button because I don't
> want any visible button to be selected when the document is opened, and
> other methods I tried failed in various ways, depending on the program used
> to view the PDF.)
>
> Thanks.
>
>                                  Jim

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : [email protected] / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________