From: Hans Hagen <pragma@wxs.nl>
Cc: ntg-context@ntg.nl
Subject: Re: AW: AW: Two more questions
Date: Fri, 12 Nov 1999 16:02:27 +0100 [thread overview]
Message-ID: <3.0.6.32.19991112160227.007d4100@pop.wxs.nl> (raw)
In-Reply-To: <0F3313EC125AD311981100105AB3A75D107B04@N0795.mdf.fvbb.de>
>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
-----------------------------------------------------------------
prev parent reply other threads:[~1999-11-12 15:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-11-12 13:19 Haseloff, Lutz
1999-11-12 15:02 ` Hans Hagen [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3.0.6.32.19991112160227.007d4100@pop.wxs.nl \
--to=pragma@wxs.nl \
--cc=ntg-context@ntg.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).