日期:2009-01-02  浏览次数:20480 次

1、动态改变表单的字段

如增加、删除或修改表单的一个或一些字段,通过 XForm的Trigger元素中嵌入delete、add、setvalue属性来实现:


<xforms:trigger>
<xforms:label>Remove current item</xforms:label>
<xforms:delete event="xforms-activate" nodeset="order/soaps/item"
at="index('soaplist')"/>
</xforms:trigger>
<xforms:trigger>
<xforms:label>Add an item</xforms:label>
<xforms:action event="xforms-activate">
<xforms:insert nodeset="order/soaps/item" at="index('soaplist')"
position="after"/>
<xforms:setvalue ref="order/soaps/item[index('soaplist')]/
qty">0</xforms:setvalue>

<xforms:setvalue ref="order/soaps/item[index('soaplist')]/
flavor">P</xforms:setvalue>
<xforms:setvalue
ref="order/soaps/item[index('soaplist')]/
unitprice">2.50</xforms:setvalue>
<xforms:setvalue
ref="order/soaps/item[index('soaplist')]/
totalprice">0.00</xforms:setvalue>
</xforms:action>
</xforms:trigger>