From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/1211 Path: main.gmane.org!not-for-mail From: Hans Hagen Newsgroups: gmane.comp.tex.context Subject: Re: AW: AW: Two more questions Date: Fri, 12 Nov 1999 16:02:27 +0100 Sender: owner-ntg-context@let.uu.nl Message-ID: <3.0.6.32.19991112160227.007d4100@pop.wxs.nl> References: <0F3313EC125AD311981100105AB3A75D107B04@N0795.mdf.fvbb.de> NNTP-Posting-Host: coloc-standby.netfonds.no Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Trace: main.gmane.org 1035392047 30862 80.91.224.250 (23 Oct 2002 16:54:07 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 23 Oct 2002 16:54:07 +0000 (UTC) Cc: ntg-context@ntg.nl Original-To: "Haseloff, Lutz" In-Reply-To: <0F3313EC125AD311981100105AB3A75D107B04@N0795.mdf.fvbb.de> Xref: main.gmane.org gmane.comp.tex.context:1211 X-Report-Spam: http://spam.gmane.org/gmane.comp.tex.context:1211 >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 -----------------------------------------------------------------