我正在创建一个小型XForms应用程序来帮助一些协作者创建复杂的元数据记录(TEI标头)。我正在继续假设用户可能需要多个会话才能完全填写项目请求的所有元数据。因此,我希望能够将表单数据保存到以特定于项目的标识符命名的文件中,然后允许返回的用户从部分完成的表单中进行选择,将数据加载回编辑器并恢复工作。不幸的是,我无法像我期望的那样获得加载功能 - 也就是说,从列表中选择文件名后,我无法将保存的表单中的数据加载回编辑器。使用XForms提交加载部分完成的表单
下面是在我的模型实例:
<xf:instance id="itemMD" xmlns="http://www.tei-c.org/ns/1.0"
src="http://localhost:8080/exist/rest/db/home/sga/model.sga.metadata.xml"></xf:instance>
<xf:instance id="control-codes" xmlns="">
<data>
<boolean1>false</boolean1>
<output-filename>temp</output-filename>
<input-filename></input-filename>
</data>
</xf:instance>
<xf:instance id="file-utils" xmlns="http://exist.sourceforge.net/NS/exist" src="http://localhost:8080/exist/rest/db/home/sga/posted_data/"></xf:instance>
,这里是提交元素:
<xf:submission id="save" method="put"
replace="none">
<xf:resource value="concat('http://localhost:8080/exist/webdav/db/home/sga/posted_data/', instance('control-codes')/output-filename)"></xf:resource>
</xf:submission>
<xf:submission id="load" method="get" replace="instance" instance="itemMD">
<xf:resource value="concat('http://localhost:8080/exist/webdav/db/home/sga/posted_data/', instance('control-codes')/input-filename)">
</xf:resource>
<xf:message ev:event="xforms-submit-error">Cannot load!</xf:message>
</xf:submission>
这里是文档正文中的相关部件:
<div id="loader" class="span4 offset8">
<xf:select1 id="load-from-file" ref="instance('control-codes')/input-filename">
<xf:label>Choose file: </xf:label>
<xf:itemset nodeset="instance('file-utils')//exist:resource">
<xf:label ref="@name"></xf:label>
<xf:value ref="@name"></xf:value>
</xf:itemset>
</xf:select1>
<xf:submit submission="load">
<xf:label>Load</xf:label>
</xf:submit>
</div>
这是我对XForms的第一次认真的工作,所以也许这里有一些明显的东西,我应该有蜜蜂能够修复,但我很难过。 (我也想知道如果我在这里传递一个字符串,我应该通过一个URI?)。我正在使用随eXistDB附带的XSLTForms处理器
谢谢你这么快回答。我熟悉Firebug和类似的工具。我查看了这些工具的输出,他们让我相信我没有正确使用xforms提交,而不是XSLTForms生成的HTTP请求不正确。 – trevormunoz 2012-07-19 20:30:57
我可以看到,单击表单中的“加载”按钮将调度xforms-submit-error事件(来自XSLTForms调试器),但是当我访问错误消息时,我只能得到“undefined”,不知道如何继续。谢谢。 – trevormunoz 2012-07-19 20:44:18