RE: xforms:choose/if?

Please note: the methods suggested by this email does NOT work.
The submission attribute is an IDREF, not an XPath expression.

So, submission="if(...)" categorically does not work.

And the xforms:when construct was a 'wanted' feature, not an
available feature.

Cheers,
John Boyer, Ph.D.
Senior Product Architect and Research Scientist
PureEdge Solutions Inc.


-----Original Message-----
From: www-forms-request@w3.org [mailto:www-forms-request@w3.org]On
Behalf Of jason@hardlight.com.au
Sent: Wednesday, March 30, 2005 8:48 PM
To: ava@vaz.ru
Cc: www-forms@w3.org
Subject: Re: xforms:choose/if?



as I said in my previous email, 
you can but you have to do it differently

instead of
   <xforms:when test="instance('first_step')//count_result = 0">
              <xforms:send submission="ws_1"/>

you need to try
              <xforms:send submission="if(instance('first_step')//count_result 
= 0 ),'ws_1',0)"/>
<xforms:send submission="if(instance('first_step')//count_result != 
0 ),'ws_2',0)"/>

etc...

the syntax might not be quite right but if you do this you will optionally 
select the thing you want done based on the test.




Quoting Alexander Anokhin <ava@vaz.ru>:

> 
> Alessandro Vernet wrote:
> > Hi Alexander,
> > 
> > Could you clarify what you mean by "Now i need to do something (toggle
> > some switch, send some data somewhere, etc..) depends on received
> > number."?
> > 
> > You can compute the integer with a bind/calculate and store it in the
> > instance.
> 
> My integer is an sql count(*) operation result from database, for
> example and i can't compute it locally.
> 
>    Then if you want to display or hide something in the view based
> > on that he can use a bind/relevant. But I am not sure this is what you are
> > looking for.
> 
> I don't wand to show/hide something (with CSS & bind/relevant) but do
> some action. The wanted feature like in XSLT:
> 
> <xforms:action ev:event="DOMActivate">
>       <xforms:choose>
>           <xforms:when test="instance('first_step')//count_result = 0">
>               <xforms:send submission="ws_1"/>
>           </xforms:when test="instance('first_step')//count_result = 1">
>           <xforms:when test="instance('first_step')">
>               <xforms:send submission="ws_2"/>
>           </xforms:when>
>           <xforms:otherwise">
>               <xforms:toggle case="case3"/>
>           </xforms:otherwise>
>        </xforms:choose>
> </xforms:action>
> 
>    Just let us know, so people on the list can elaborate
> > further.
> 
> Thanx for answer anyway and sorry for my casual english.
> 
> 
> > --- Alexander Anokhin <ava@vaz.ru> wrote:
> > 
> >>Hi, all...
> >>Q: How can i achieve some kind of "choose/if" functionality in XForms?
> >>The use case is:
> >>1. User input some data and press "Proceed";
> >>2. XForms send it to server (with replace="instance");
> >>3. The answer is a some integer number;
> >>4. Now i need to do something (toggle some switch, send some data 
> >>somewhere, etc..) depends on received number.
> >>
> >>Is it possible?
> 
> -- 
> Alexander Anokhin
> AVTOVAZ JSC
> email: ava@vaz.ru
> icq: 123275798
> 
> 

Received on Friday, 1 April 2005 00:58:13 UTC