- From: Klotz, Leigh <Leigh.Klotz@xerox.com>
- Date: Mon, 4 Apr 2005 16:46:57 -0700
- To: <jeacott@hardlight.com.au>, "Alexander Anokhin" <ava@vaz.ru>
- Cc: <www-forms@w3.org>
I think an XSLT-like choose/when for XML Events handlers would be great.
I don't see it in the XForms 1.1 requirements document, but as Mark
Birbeck said, I would find it most welcome coming from an XML Events 2
recommendation.
Leigh.
-----Original Message-----
From: www-forms-request@w3.org [mailto:www-forms-request@w3.org] On
Behalf Of Jason Eacott
Sent: Friday, April 01, 2005 1:09 AM
To: Alexander Anokhin
Cc: www-forms@w3.org
Subject: Re: xforms:choose/if?
that's a lot of messing about to achieve a simple 'if then else' huh.
I really hope that a better way becomes available soon.
Date sent: Fri, 01 Apr 2005 11:23:32 +0500
From: Alexander Anokhin <ava@vaz.ru>
Send reply to: ava@vaz.ru
Organization: AVTOVAZ JSC
To: Mark Birbeck <mark.birbeck@x-port.net>
Copies to: www-forms@w3.org
Subject: Re: xforms:choose/if?
Forwarded by: www-forms@w3.org
Date forwarded: Fri, 01 Apr 2005 06:24:53 +0000
>
> Mark Birbeck:
> > Alexander,
> >
> > The only way you can do this *today* is with a little bit of script
(see
> > below).
> >
> > For the future, some work has been done in XML Events 2 to provide
> > conditional event handlers, which would do pretty much what you
want...
>
>
> If someone interested in, the way i choose to realize such thing
(thanx
> to Giovanni Motta for idea)
>
> I've made an additional instance wich is contains one copy of
> "count_result" for every condition, like this:
> <xforms:instance id="choose">
> <data xmlns="">
> <eq0>84</eq0>
> <eq1>84</eq1>
> <gt1>84</gt1>
> </data>
> </xforms:instance>
>
> ...add binds and event handlers:
>
> <xforms:bind id="eq0_bind" nodeset="instance('choose')/eq0"
> constraint="not(. = '0') or . = ''"/>
> <xforms:bind id="eq1_bind" nodeset="instance('choose')/eq1"
> constraint="not(. = '1') or . = ''"/>
> <xforms:bind id="gt1_bind" nodeset="instance('choose')/gt1"
> constraint="not(. > '1') or . = ''"/>
>
> <xforms:action ev:event="eq0_event">
> <xforms:message level="modal">eq0</xforms:message>
> </xforms:action>
>
> <xforms:action ev:event="eq1_event">
> <xforms:message level="modal">eq1</xforms:message>
> </xforms:action>
>
> <xforms:action ev:event="changed3">
> <xforms:message level="modal">gt1</xforms:message>
> </xforms:action>
>
> Finally the hidden controls for dispatch "xforms-invalid" event:
>
> <xforms:input bind="eq0_bind" style="display:none;">
> <xforms:dispatch ev:event="xforms-invalid" name="eq0_event"
> target="mymodel"/>
> </xforms:input>
>
> <xforms:input bind="eq1_bind" style="display:none;">
> <xforms:dispatch ev:event="xforms-invalid" name="eq1_event"
> target="mymodel"/>
> </xforms:input>
>
> <xforms:input bind="gt1_bind" style="display:none;">
> <xforms:dispatch ev:event="xforms-invalid" name="gt1_event"
> target="mymodel"/>
> </xforms:input>
>
> surely works on FormsPlayer 1.3.
>
> --
> Alexander Anokhin
> AVTOVAZ JSC
> email: ava@vaz.ru
> icq: 123275798
>
Received on Monday, 4 April 2005 23:47:38 UTC