我用一些文本输出控件制作了一个表单,这些控件也由其他一些具有计算值的控件计算了值。问题是,在测试模式下(来自构建器),这些控件正常工作。在 runner 中,这些控件始终为 0(空)。保存文档并再次打开后,值正确,但不刷新。
这是我的例子:
<xforms:instance id="fr-form-instance">
<form>
<section-1>
<first>
<first_amount/>
<first_percent/>
<first_total/>
</first>
<second>
<second_amount/>
<second_percent/>
<second_total/>
</second>
<third>
<third_amount/>
<third_percent/>
<third_total/>
</third>
<total/>
<average/>
</section-1>
</form>
</xforms:instance>
还有我的绑定:
<xforms:bind xmlns:dataModel="java:org.orbeon.oxf.fb.DataModel" id="fr-form-binds"
nodeset="instance('fr-form-instance')">
<xforms:bind id="section-1-bind" name="section-1" ref="section-1">
<xf:bind name="first" id="first-bind" ref="first">
<xf:bind name="first_amount" id="first_amount-bind" ref="first_amount"
type="xf:decimal"/>
<xf:bind xmlns:fb="http://orbeon.org/oxf/xml/form-builder" name="first_percent"
id="first_percent-bind"
ref="first_percent"
type="xf:decimal"
constraint="./text()>=0 or string-length(./text())=0"/>
<xf:bind xmlns:fb="http://orbeon.org/oxf/xml/form-builder" name="first_total"
id="first_total-bind"
ref="first_total"
calculate="(../first_amount/text() * ../first_percent/text()) div 100"
type="xf:decimal"/>
</xf:bind>
<xf:bind name="second" id="second-bind" ref="second">
<xf:bind name="second_amount" id="second_amount-bind" ref="second_amount"
type="xf:decimal"/>
<xf:bind xmlns:fb="http://orbeon.org/oxf/xml/form-builder" name="second_percent"
id="second_percent-bind"
ref="second_percent"
type="xf:decimal"
constraint="./text()>=0 or string-length(./text())=0"/>
<xf:bind xmlns:fb="http://orbeon.org/oxf/xml/form-builder" name="second_total"
id="second_total-bind"
ref="second_total"
calculate="(../second_amount/text() * ../second_percent/text()) div 100"
type="xf:decimal"/>
</xf:bind>
<xf:bind name="third" id="third-bind" ref="third">
<xf:bind name="third_amount" id="third_amount-bind" ref="third_amount"
type="xf:decimal"/>
<xf:bind xmlns:fb="http://orbeon.org/oxf/xml/form-builder" name="third_percent"
id="third_percent-bind"
ref="third_percent"
type="xf:decimal"
constraint="./text()>=0 or string-length(./text())=0"/>
<xf:bind xmlns:fb="http://orbeon.org/oxf/xml/form-builder" name="third_total"
id="third_total-bind"
ref="third_total"
calculate="(../third_amount/text() * ../third_percent/text()) div 100"
type="xf:decimal"/>
</xf:bind>
<xf:bind xmlns:fb="http://orbeon.org/oxf/xml/form-builder" name="total"
id="total-bind"
ref="total"
calculate="sum(instance('fr-form-instance')/section-1/first/first_total/text()) + sum(instance('fr-form-instance')/section-1/second/second_total/text()) + sum(instance('fr-form-instance')/section-1/third/third_total/text())"
type="xf:decimal"/>
<xf:bind xmlns:fb="http://orbeon.org/oxf/xml/form-builder" name="average"
id="average-bind"
ref="average"
type="xf:decimal"
calculate="instance('fr-form-instance')/section-1/total/text() div (count(instance('fr-form-instance')/section-1/first) + count(instance('fr-form-instance')/section-1/second) + count(instance('fr-form-instance')/section-1/third))"/>
</xforms:bind>
</xforms:bind>