我做的一切都像提到的教程:http ://wiki.orbeon.com/forms/how-to/logic/load-initial-form-data我的意思是:
....
<xf:model id="fr-form-model" xxf:expose-xpath-types="true">
<!-- User in which user data is collected -->
<xf:instance id="user-data">
<registration>
<first-name/>
<last-name/>
</registration>
</xf:instance>
<!-- Load initial data from a service -->
<xf:send ev:event="xforms-model-construct-done" submission="load-data-submission"/>
<xf:submission id="load-data-submission" method="get" serialization="none"
resource="http://github.com/orbeon/orbeon-forms/raw/master/src/resources/apps/xforms-sandbox/samples/howto/load-initial-form-data-pull-instance.xml"
replace="instance"
instance="user-data"/>
<!-- Main instance -->
<xf:instance id="fr-form-instance">
<form>
<name/>
....
....
<fr:body xmlns:xbl="http://www.w3.org/ns/xbl"
xmlns:dataModel="java:org.orbeon.oxf.fb.DataModel"
xmlns:oxf="http://www.orbeon.com/oxf/processors"
xmlns:p="http://www.orbeon.com/oxf/pipeline">
....
<xforms:action ev:event="xforms-enabled">
<xforms:setvalue ref="xxf:instance('fr-form-instance')/name"
value="xxf:instance('user-data')/first-name"/>
</xforms:action>
</fr:body>
....
我想从链接(http://github.com/orbeon/orbeon-forms/raw/master/src/resources/apps/xforms-sandbox/samples/howto/load-initial-form-data-pull- instance.xml),放入“用户数据”实例,然后获取名字并放入“fr-form-instance”中的“名称”标记。不幸的是它不起作用,我的意思是 setvalue 不起作用,因为当我像这样更改“用户实例”时:
<xf:instance id="user-data">
<registration>
<first-name>SomeName</first-name>
<last-name/>
</registration>
</xf:instance>
它工作,最终的 xml 看起来像:
....
<name>SomeName</name>
....
我真的不知道为什么它不起作用。
问候
///
现在我看到我的问题可能会简化为:
有用:
<xforms:instance id="user-data" src="http://example.org/service/load-initial-form-data-pull-instance"/>
它不起作用:
<xforms:send ev:event="xforms-model-construct-done" submission="load-data-submission"/>
<xforms:submission id="load-data-submission"
method="get" serialization="none"
resource="http://example.org/service/load-initial-form-data-pull-instance"
replace="instance" instance="user-data"/>
我必须使用第二种方式,因为我必须将一些参数传递给资源 (resource="http.../{xxforms:get-request-parameter('myParam')}")