You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by MÂȘ Magdalena Buades Fuster <ma...@uib.es> on 2009/06/29 10:31:12 UTC

Problem with union binding value

I want to try make a form with two possibilities depending of a widget's 
value (test).
The first time is correct, because the union is loaded correctly.
But when I change the selecion-list (widget test) I lost the values, 
even if I select the initial value loaded again.
But, if the widgets test1 and test2 are with state="output" it works 
correctly.

This is the definition:

<fd:form>
  <fd:widgets>  
    <fd:field id="test">
      <fd:label>Test</fd:label>
      <fd:datatype base="string" />
      <fd:selection-list>
        <fd:item value="1">One</fd:item>
        <fd:item value="2">Two</fd:item>
      </fd:selection-list>
    </fd:field>
    <fd:union id="union-prova" case="prova">
      <fd:widgets>
        <fd:group id="1">
          <fd:widgets>
            <fd:field id="test1">
              <fd:label>Test 1</fd:label>
              <fd:datatype base="string" />
            </fd:field>
          </fd:widgets>
        </fd:group>
        <fd:group id="2">
          <fd:widgets>
            <fd:field id="test2">
              <fd:label>Test 2</fd:label>
              <fd:datatype base="string" />
            </fd:field>
          </fd:widgets>
        </fd:group>
      </fd:widgets>
    </fd:union>
  </fd:widgets>
</fd:form>

Template:

<ft:widget id="test"/>
<ft:union id="union-test">
  <ft:case id="1">
    <ft:group id="1">
      <ft:widget id="test1"/>
    </ft:group>
  </ft:case>
  <ft:case id="2">
    <ft:group id="2">
      <ft:widget id="test2" />       
    </ft:group>
  </ft:case>
</ft:union>    

Binding:

<fb:context path="TEST" direction="load">
  <fb:value id="test" path="@Test" />
  <fb:union id="union-test" path=".">
    <fb:group id="1" path=".">
      <fb:value id="test1" path="TEST1" />
    </fb:group>
    <fb:group id="2" path=".">
      <fb:value id="test2" path="TEST2" />
    </fb:group>
  </fb:union>
</fb:context>

Data XML:

<TEST Test="2">
  <TEST1>Test 1</TEST1>
  <TEST2>Test 2</TEST2>
</TEST>

Thanks

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org