如何将请求参数传递给“persistence-model.xml”中的“fr-workflow-send-submission”?

时间:2012-06-27 18:52:33

标签: orbeon

如何将请求参数传递给“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”始终是emtpy。

我还尝试在“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”仍然是空的。

1 个答案:

答案 0 :(得分:1)

您不能在变量上使用<xforms:setvalue>,并且在定义变量时,还需要说明<xxforms:variable name="myVariable" value="xpath"/>的值是什么,或者使用最近的版本(以及即将发布的版本) Orbeon Forms 4.0):<xforms:var name="myVariable" value="xpath"/>,因为variables正在进入XForms 2.0。

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

  1. <xxforms:variable name="myVariable"/><xforms:instance id="myInstance"><instance></xforms:instance>
  2. $myVariableinstance('myInstance')