ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Rik Kabel <context@rik.users.panix.com>
To: ntg-context@ntg.nl
Subject: Re: Forms and JavaScript
Date: Thu, 02 Apr 2015 11:07:18 -0400	[thread overview]
Message-ID: <551D5B26.60004@rik.users.panix.com> (raw)
In-Reply-To: <C9414CA8-92F7-4D48-B63D-6C815D0BCE29@fiee.net>

On 2015-04-02 03:42, Henning Hraban Ramm wrote:
> Hello,
>
> while trying to create some interactive forms using latest beta (MkIV), I found that JavaScripts are only then copied into the PDF, if there’s a \goto referencing a JS function.
>
> According to the old widgets manual I thought I could set default values of fields calling JS functions or variables as [JS(MyFunc)], but that doesn’t work.
>
>
> \starttext
>
> \setupinteraction	[state=start]
>
> \startJSpreamble{formtest}
> % this JS code is only copied to the PDF if the \goto below is uncommented!
> var d = new Date();
> var df = this.getField("Datum");
> var CurDate = util.printd("dd.mm.yyyy", d);
> df.value = CurDate;
>
> function toggleField(){
> 	var f = this.getField("Datum");
> 	f.display = ! f.display;
> }
> \stopJSpreamble
>
> %\goto{toggle}[JS(toggleField)]
> \blank
>
> \setupfield[MMshortString][reset,horizontal][height=5mm, width=50mm, frame=off, bottomframe=on]
>
> \definefield[Datum][line][MMshortString][][JS(CurDate)] % JS(CurDate) ends up verbatim in the field
>
>
> Date: \field[Datum]
>
>
> \stoptext
>
>
> Greetlings, Hraban
>
Greetlings Hraban,

This appears to be a pdf reader problem. On Win 8.1, Windows Reader and 
Chrome both show an editable field; Firefox and Sumatra show a 
non-editable field.

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

  reply	other threads:[~2015-04-02 15:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-02  7:42 Henning Hraban Ramm
2015-04-02 15:07 ` Rik Kabel [this message]
2015-04-03  5:06   ` Henning Hraban Ramm
2015-10-06  4:34     ` Henning Hraban Ramm
2015-10-06 23:18       ` Hans Hagen
2015-10-07  9:56         ` Henning Hraban Ramm
2015-10-07 11:13           ` Hans Hagen

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=551D5B26.60004@rik.users.panix.com \
    --to=context@rik.users.panix.com \
    --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).