Re: toggle on a switch with caseref

I propose the following steps as the new description:

Deferred update behavior is invoked.

A case identifier is obtained from the case child element of the toggle  
element or otherwise from the case attribute. If no case element is  
identified by this value, then the toggle action has no effect.

The switch containing the identified case is identified.

If the switch has a caseref attribute which identifies a node, and that  
node is not readonly, then
the node is set to the value of the case identifier as if by a  
<code>setvalue</code> action.

An xforms-deselect event is dispatched to the currently selected case in  
the switch.

The selected states (not the attribute values) on the affected cases are  
adjusted to reflect the new state.

An xform-select event is dispatched to the newly identified case.

Steven


On Thu, 20 Oct 2016 15:14:56 +0200, Steven Pemberton  
<steven.pemberton@cwi.nl> wrote:

> In the context of
>
>   <switch ref="payment/details" caseref="@method">
>    <case name="creditCard" label="Credit Card Details">
>      ...
>    </case>
>    <case name="cash" label="Cash">
>      ...
>    </case>
>    ...
>   </switch>
>
> if I do
>
>   <setvalue "payment/details@method">cash</setvalue>
>
> then the cash case will be selected.
>
> If I do
>
>   <toggle case="cash"/>
>
> do we agree that @method gets the value "cash" assigned?
>
> The current text is rather opaque:
>
> "If the switch that contains the identified case specifies the caseref  
> attribute, then the behavior of this action is associated with the  
> ability to successfully perform a setvalue on the node indicated by the  
> caseref. If the caseref does not indicate a node or if the node is  
> readonly, then this action has no effect. Otherwise, the node value is  
> changed to the IDREF value obtained above, which then results in the  
> three toggle steps described above."
>
> I intend to rewrite this, once I'm sure we agree on the effect.
>
> Steven

Received on Thursday, 20 October 2016 13:27:15 UTC