* AW: AW: Two more questions
@ 1999-11-12 13:19 Haseloff, Lutz
1999-11-12 15:02 ` Hans Hagen
0 siblings, 1 reply; 2+ messages in thread
From: Haseloff, Lutz @ 1999-11-12 13:19 UTC (permalink / raw)
> Did you enable interaction by state=start?
> By default, context does reset a form
> (otherwise acrobat has troubles with unitiated
> fields). Also, the default is to go to the first page.
> openaction={firstpage,ResetForm}
> You can do a grep in the pdf file on resetform to check this.
> Hans
Hi Hans,
I play with following file to get a field with the current date:
(my first try with JS)
\setupoutput [pdftex]
\setuppapersize[S6][S6]
\setupinteraction[state=start,
color=red,
openaction=ResetForm,
closeaction=ExitViewer]
\setupinteractionscreen[option=max]
\setupcolors[state=start]
\startJScode{Datum}
{ this.d = new Date();
event.value = util.printd("dd. mmmm yyyy", d); }
\stopJScode
\setupfield [DatumSetup] [frame=off,width=8cm,height=7mm,validate=JS(Datum)]
\definefield [datum] [line] [DatumSetup]
\starttext
today is the: \raise-2.2mm\hbox{\field[datum]}
\goto{Reset}[ResetForm]
\stoptext
when i open the pdf with acrobat reader the field is empty.
i must click on the link with the same reference
or fill something in the field and press enter.
with acrobat exchange i found no openaction in the pdf.
is there a smarter way to define such a date field?
Lutz
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: AW: AW: Two more questions
1999-11-12 13:19 AW: AW: Two more questions Haseloff, Lutz
@ 1999-11-12 15:02 ` Hans Hagen
0 siblings, 0 replies; 2+ messages in thread
From: Hans Hagen @ 1999-11-12 15:02 UTC (permalink / raw)
Cc: ntg-context
>I play with following file to get a field with the current date:
>(my first try with JS)
>
>\setupoutput [pdftex]
>\setuppapersize[S6][S6]
>\setupinteraction[state=start,
>color=red,
>openaction=ResetForm,
>closeaction=ExitViewer]
>\setupinteractionscreen[option=max]
>\setupcolors[state=start]
>\startJScode{Datum}
> { this.d = new Date();
> event.value = util.printd("dd. mmmm yyyy", d); }
>\stopJScode
>\setupfield [DatumSetup] [frame=off,width=8cm,height=7mm,validate=JS(Datum)]
>\definefield [datum] [line] [DatumSetup]
>\starttext
>today is the: \raise-2.2mm\hbox{\field[datum]}
>
>\goto{Reset}[ResetForm]
>\stoptext
>
>when i open the pdf with acrobat reader the field is empty.
>i must click on the link with the same reference
>or fill something in the field and press enter.
>with acrobat exchange i found no openaction in the pdf.
>is there a smarter way to define such a date field?
\setupoutput [pdftex]
\setuppapersize[S6][S6]
\setupinteraction
[state=start,
color=red,
openaction=ResetForm,
closeaction=ExitViewer]
\setupinteractionscreen
[option=max]
\setupcolors
[state=start]
\startJSpreamble {Initialize} used now
function SetDate (name)
{ this.d = new Date() ;
v = this.getField(name) ;
if (v) { v.value = util.printd("dd. mmmm yyyy", d) } }
SetDate ("date") ;
\stopJSpreamble
\setupfield
[DatumSetup]
[frame=off,width=8cm,height=4ex]
\definefield
[date] [line] [DatumSetup]
\starttext
today is the: \lower1ex\hbox{\field[date]}
\goto{Reset}[ResetForm]
\goto{Set}[JS(SetDate{date})]
\stoptext
As you can see, context picks up the function from the preamble automatically. Saves you some typing.
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.nl
-----------------------------------------------------------------
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1999-11-12 15:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-11-12 13:19 AW: AW: Two more questions Haseloff, Lutz
1999-11-12 15:02 ` Hans Hagen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).