0

如何将请求参数传递给“persistence-model.xml”中的“fr-workflow-send-submission”?例如,如果我打开一个表单:

.../orbeon..?myRequestParameter=myRequestParameterValue

然后将 myRequestParameter 传递给“oxf.fr.detail.send.success.uri ...

我尝试执行以下操作:

    <xforms:model id="fr-persistence-model"....

                                  ....

            <xxforms:variable name="parameters" value="xxforms:instance('fr-parameters- instance')" as="element()"/>
            <xxforms:variable name="app" value="$parameters/app" as="xs:string"/>
            <xxforms:variable name="form" value="$parameters/form" as="xs:string"/>
            <xxforms:variable name="document" select="$parameters/document"/>
            <xxforms:variable name="mode" select="$parameters/mode"/>

                                  ....

            <xxforms:variable name="myVariable"/>

                                  ....

            <xforms:action ev:event="xforms-model-construct-done" if="$app != '*' and $form != '*'">

                                  ....

                    <xforms:setvalue ref="$myVariable" value="xxforms:get-request-parameter('myRequestParameter')">

                                  ....

           <xforms:submission id="fr-workflow-send-submission"
                  resource="{$workflow-success-uri}?myRequestParameter={$myVariable}"
                  relevant="{xxforms:property(string-join(('oxf.fr.detail.send.success.prune', $app, $form), '.'))}"
                  validate="false" method="{$workflow-success-method}"
                  serialization="{if ($workflow-success-method = 'get') then 'none' else 'application/xml'}"
                  ref="if (instance('fr-workflow-send-instance') != '') then instance('fr-workflow-send-instance') else xxforms:instance('fr-form-instance')"
                  replace="all"/>

                                  ....

并且变量“myVariable”始终为空。

我还尝试对“xforms-model-construct-done”事件进行插入:

                                      ....
                  <xxforms:variable name="parameters" value="xxforms:instance('fr-parameters- instance')" as="element()"/>
                  <xxforms:variable name="myVariable" select="$parameters/myRequestParameter"/> 

                                      ....
//on xforms-model-construct-done
        <xforms:action>
            <xxforms:variable name="myRequestParameter-name" select="'myRequestParameter'"/>
            <xxforms:variable name="myRequestParameter-value" select="xxforms:get-request-parameter($myRequestParameter-name)"/>
            <xforms:insert context="instance('fr-parameters- instance')" origin="xxforms:element($myRequestParameter-name, $myRequestParameter-value)"/>
        </xforms:action>

                                      ....

但“myVariable”仍然是空的。

4

1 回答 1

1

你不能<xforms:setvalue>在变量上使用,当你定义一个变量时,你还需要说明它的值是什么<xxforms:variable name="myVariable" value="xpath"/>,或者如果使用最近的构建(以及即将推出的 Orbeon Forms 4.0):,<xforms:var name="myVariable" value="xpath"/>因为变量正在进入XForms 2.0。

这里你想要的是一个实例。尝试替换:

  1. <xxforms:variable name="myVariable"/><xforms:instance id="myInstance"><instance></xforms:instance>
  2. $myVariableinstance('myInstance')
于 2012-06-28T21:42:19.310 回答