W3C home > Mailing lists > Public > www-forms@w3.org > April 2006

Re: XForms timer

From: Allan Beaufour <beaufour@gmail.com>
Date: Thu, 27 Apr 2006 18:36:50 +0200
Message-ID: <90d6cb0e0604270936i58869ad4ve9e45a4ad9cfea8d@mail.gmail.com>
To: "Erik Bruchez" <ebruchez@orbeon.com>
Cc: "Xforms W3C WG" <www-forms@w3.org>

On 4/26/06, Erik Bruchez <ebruchez@orbeon.com> wrote:
> If you can't do it directly with XForms, how do you do it, with Javascript?

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ev="http://www.w3.org/2001/xml-events"
      xmlns:xforms="http://www.w3.org/2002/xforms">
  <head>
    <title>Timer</title>
    <script type="text/javascript">
      function timer() {
        var ev = document.createEvent("Events");
        ev.initEvent("increment", true, true);
	document.getElementById("setv").dispatchEvent(ev);
	window.setTimeout(timer, 1000);
      }

      window.setTimeout(timer, 1000);
    </script>
    <xforms:model>
      <xforms:instance xmlns="">
        <data xmlns="">
          <counter>1</counter>
        </data>
      </xforms:instance>
      <xforms:setvalue id="setv" ref="counter" value=". + 1"
		       ev:event="increment"/>
    </xforms:model>
  </head>
  <body>
    <xforms:output ref="counter">
      <xforms:label>Counter: </xforms:label>
    </xforms:output>
  </body>
</html>

--
... Allan
Received on Thursday, 27 April 2006 16:36:58 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 10 March 2012 06:22:03 GMT