'stubborn' if attribute on action

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

'stubborn' if attribute on action

Hank Ratzesberger

Speaking of if attribute on action, I have an action element as a  
child of a
widget:tab, and previously I have always found it to receive the  
xforms-select
event.  And I want to run a submission if a flag I have set is true.  
The
inspector indicates that "dirty" flag is getting switched true when  
various
controls are changed, and false when the submission runs.

But the submission runs regardless.

The source code below shows my latest attempt, adding the xforms  
namespace
prefix and also wrapping the value in boolean() function.


** from the inspector, the "all-select" instance **
<select>
   <dirty>false</dirty></select>
</select

** source code **

<widget:tab id="waveforms-tab">
   <widget:label>Waveforms</widget:label>

    <xforms:action ev:event="xforms-select" xforms:if="boolean
(instance('all-select')/dirty)">
      <xforms:send submission="wfquery"/>
      <xforms:setvalue ref="instance('all-select')/dirty" value="false
()"/>
    </xforms:action>
....

Regards,
Hank


Hank Ratzesberger
NEES@UCSB
Institute for Crustal Studies,
University of California, Santa Barbara
805-893-8042







--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: 'stubborn' if attribute on action

Hank Ratzesberger

OK, perhaps I don't understand the spec,
I assume that a single node value bound
to type xs:boolean will always evaluate to
true() or false(), but the if attribute only
works if I compare strings with 'true'.

<instance id="dirty-flag">
  <dirty-flag xmlns="">
    <is-dirty>false</is-dirty>
  </dirty-flag>
</instance>

<bind nodeset="instance('dirty-flag')/is-dirty"
  type="xs:boolean"/>

<!-- Does NOT work -->

<action ev:event="xforms-select"
   if="instance('dirty-flag')/is-dirty">
  <send submission="my-sub"/>
  <setvalue ref="instance('dirty-flag')/is-dirty"
    value="false()"/>
</action>

but this works

   if="instance('dirty-flag')/is-dirty='true')"

So, I am reporting this possible issue.

Regards,
Hank

> Hank Ratzesberger
> NEES@UCSB
> Institute for Crustal Studies,
> University of California, Santa Barbara
> 805-893-8042




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: 'stubborn' if attribute on action

Erik Bruchez
Administrator
>   if="instance('dirty-flag')/is-dirty">

This is called an "existence test": it will return true() if the  
element "is-dirty" exists. So it will always return true() in your case.

>   if="instance('dirty-flag')/is-dirty='true')"

Now here you are testing that the text content of the "is-dirty"  
element is equals to "true", which will obviously work as you expect.

> So, I am reporting this possible issue.


It's not a bug, it's a feature ;-)

Now you could argue that IF "is-dirty" has a bound type of xs:boolean,  
then references to the "is-dirty" node should behave as a boolean,  
i.e. with an implicit cast.

However in XForms, there is currently no such mechanism and no such  
requirement for implicit casting. But once we officially support XPath  
2.0 in XForms, we will have to think about whether we need this kind  
of behavior.

-Erik

--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.com/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws