[英]Event xforms-model-construct-done behaviour
In my form I would like to call web service after to form is loaded after publishing. 在我的表单中,我想在发布后加载表单后调用Web服务。 I've created custom XBL control for it, where I have :
我已经为其创建了自定义XBL控件:
<xf:group id="component-group">
<xf:action ev:event="xforms-enabled" ev:target="component-group">
<xf:send ev:event="xforms-enabled" submission="my-submission"/>
</xf:action>
</xf:group>
But it doesn't work as expected : my submission is sent everytime when I add new element in FormBuilder or change a name of some other controls. 但这并没有按预期的那样工作:每当我在FormBuilder中添加新元素或更改某些其他控件的名称时,都会发送我的提交。 Generally speaking submission is sent when my form is changing in some way.
一般来说,当我的表单以某种方式更改时,将发送提交。
Now I want submission to be sent ONLY when I publish my form and someone would open it to fill (and of course when I press "Test" in FormBuilder, but I guess it's the same as filling form after publishing). 现在,我希望仅在发布表单时发送提交,然后有人会打开它进行填充(当然,当我在FormBuilder中按“测试”时,但我想它与发布后填充表单相同)。
I was trying something like this : 我正在尝试这样的事情:
<xf:group id="component-group">
<xf:action ev:event="xforms-model-construct-done" ev:target="component-group">
<xf:send ev:event="xforms-model-construct-done" submission="my-submission"/>
</xf:action>
</xf:group>
Unfortunately it's not working, this way submission is not sent at all. 不幸的是,它不起作用,这种方式根本不发送提交。 Any thoughts ?
有什么想法吗 ?
This is due to the fact that XBL components are live at design time too. 这是由于XBL组件也在设计时处于活动状态。 So you need a way to test whether the component is running within Form Builder or not.
因此,您需要一种方法来测试组件是否在Form Builder中运行。
There should be a function for this, really, but there isn't (I added this to the list of functions we should add to the API here ). 确实应该有一个函数,但没有(我在这里将它添加到了应该添加到API的函数列表中)。 You can do:
你可以做:
<xf:group id="component-group"> <xf:var name="fr-params" value="xxf:instance('fr-parameters-instance')"/> <xf:action event="xforms-enabled" target="component-group" if="not($fr-params/app = 'orbeon' and $fr-params/form = 'builder')"> <xf:send submission="my-submission"/> </xf:action> </xf:group>
A few minor comments: 一些小意见:
event
attributes on nested actions event
属性放在嵌套动作上 ev
prefix ev
前缀
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.