You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Karel Vervaeke <ka...@telenet.be> on 2004/09/09 00:02:21 UTC

[cforms] union case="integer-widget"

When you run the example below, you get a ClassCastException,
when you make the change indicated by the comments, the example works fine

Should it be considered a bug or not?

-- def --
<fd:field id="case-widget">
  <fd:datatype base="integer"/> <!-- change this to string and it works -->
</fd:field>

<fd:union id="extra-widgets" case="case-widget">
  <fd:widgets>
    <fd:field id="extra-field">
      <fd:datatype base="string"/>
    </fd:field>
  </fd:widgets>
</fd:union>

-- bind --
<fb:value id="case-widget" path="pathToAnInteger" />

-- template --
<ft:union id="extra-widgets">
  <ft:case id="0">
    <ft:widget id="extra-field"/>
  </ft:case>
</ft:union>

(partial) workaround:
If you only need on-load binding, you can work around the problem by 
making case-widget/datatype/@base="string" and putting this in the binding:

<fb:value id="case-widget" path="concat('',pathToAnInteger)" 
direction="load"/>