Orbeon从3.9升级到4.5:自定义提交以保存表单

时间:2014-06-02 15:49:42

标签: forms orbeon

我们正在从3.9升级到4.5。

在一些3.9 Orbeon表格中,我们使用自定义提交按钮进行保存。

这不适用于4.5 Orbeon表格。当我点击“提交”时,它不会将表单保存到orbeon_form_data表。

以下是“submit”的源代码部分,

<xhtml:head>
    <xforms:bind id="eoisave-btn-bind" ref="eoisave-btn" name="eoisave-btn" type="xforms:string"
                 relevant="$Bidlist_IsBidding != ''"/>
</xhtml:head>
<xhtml:body>
    <fr:button id="eoisave-btn-control" bind="eoisave-btn-bind">
        <xforms:label ref="$form-resources/eoisave-btn/label"/>
        <xforms:hint ref="$form-resources/eoisave-btn/hint"/>
        <xforms:alert ref="$fr-resources/detail/labels/alert"/>
    </fr:button>
    <xforms:action ev:event="DOMActivate" ev:observer="eoisave-btn-control">
        <xforms:setvalue if="xxforms:instance('fr-error-summary-instance')/valid = 'true'"
                         ref="./EOISaved"
                         value="1"/>
        <xforms:setvalue ref="./user-action">submit eoi</xforms:setvalue>
        <xforms:dispatch name="fr-save-action" target="fr-persistence-model">
            <xxforms:context name="fr:check-data-valid" select="true()"/>
        </xforms:dispatch>
    </xforms:action>
</xhtml:body>

在orbeon日志中,我可以找到以下内容。

+----------------------------------------------------------------------------------------------------------------------+
|An Error has Occurred                                                                                                 |
|----------------------------------------------------------------------------------------------------------------------|
|Cannot compare xs:boolean to xs:string                                                                                |
|----------------------------------------------------------------------------------------------------------------------|
|Application Call Stack                                                                                                |
|----------------------------------------------------------------------------------------------------------------------|
|----------------------------------------------------------------------------------------------------------------------|
|Exception: org.orbeon.saxon.trans.XPathException                                                                      |
|----------------------------------------------------------------------------------------------------------------------|

1 个答案:

答案 0 :(得分:0)

Orbeon Forms 4.5具有简单的流程,您可以将其与按钮相关联。见Form Runner: Buttons and Processes。使用它们的好处是你不像3.9那样依赖Form Runner的内部。现在我不确定进程允许你做你想做的所有事情,比如设置值,但我想我会提到它们。

这说,作为第一步,尝试改变:

xxforms:instance('fr-error-summary-instance')/valid = 'true'

为:

xxforms:instance('fr-error-summary-instance')/valid = true()

其次,fr-save-action消失了。这是一个内部的Form Runner事件。请尝试改为:

<xf:action type="xpath" xmlns:process="java:org.orbeon.oxf.fr.process.SimpleProcess">
    process:runProcessByName('oxf.fr.detail.process', 'save-final')
</xf:action>

请注意,我没有对此进行测试。