- From: Mark Birbeck <mark.birbeck@x-port.net>
- Date: Sun, 3 Apr 2005 23:41:35 +0100
- To: <ava@vaz.ru>
- Cc: <www-forms@w3.org>
Hi Alex, Yes, that technique does indeed work, but I wasn't keen to mention it because it mixes up the UI and the model -- nice workaround though! Just for your reference, there has been some discussion about allowing model status events to be picked up in the model, so in a future version of XForms you should be able to do something this: <xforms:bind id="eq0_bind" nodeset="instance('choose')/eq0" constraint="not(. = '0') or . = ''" > <xforms:dispatch ev:event="xforms-invalid" name="eq0_event" target="mymodel" /> </xforms:bind> That will save you having to create the 'dummy' UI controls if you want to use this technique. I'm sure you have done this, but I would suggest to anyone else that is going to use this approach, that they place all of their 'dummy' controls into a xf:group and hide that. Then in a future version of XForms that allows for conditional events (or events directed to xf:bind statements) you can easily locate the 'trampolines' and move them to the model. However, I still prefer the script solution, since although it uses script, it more closely resembles the logic of what will probably be the future solution, namely conditional event handlers. Regards, Mark Mark Birbeck CEO x-port.net Ltd. e: Mark.Birbeck@x-port.net t: +44 (0) 20 7689 9232 w: http://www.formsPlayer.com/ b: http://internet-apps.blogspot.com/ Download our XForms processor from http://www.formsPlayer.com/ > -----Original Message----- > From: www-forms-request@w3.org > [mailto:www-forms-request@w3.org] On Behalf Of Alexander Anokhin > Sent: 01 April 2005 07:24 > To: Mark Birbeck > Cc: www-forms@w3.org > Subject: Re: xforms:choose/if? > > > 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 Sunday, 3 April 2005 22:42:07 UTC