问题描述
我想在将表单保存在Form Builder中后发送提交,我最初是在XBL文件中尝试过这样的事情:
I would like to send submission after form has been saved in Form Builder, I was trying something like this at first (in my XBL file):
<xf:action ev:event="fr-data-save-done" ev:observer="fr-form-model">
<xf:message event="#all" level="modal">Saved</xf:message>
<xf:send submission="my-submission" ev:event="#all"/>
</xf:action>
上面的代码放在xbl:template之间的xbl:template之间,在xbl:model之外(尽管我试图将它放在xbl:model里面没有运气).不幸的是,在我将表单保存到Form Builder中后,它不起作用.有人知道为什么它不起作用吗?
The code above is placed in XBL file between xbl:template, outside xbl:model (though I tried to put it inside xbl:model with no luck).Unfortunately it's not working, after I save my form in Form Builder message is not shown.Anyone got idea why it's not working?
推荐答案
您可以手动放置一个事件处理程序,如下所示:
You could place by hand an event handler like this:
<foo:bar id="my-component-id" bind="my-bind">
<xf:dispatch
event="fr-data-save-done"
observer="fr-form-model"
name="my-custom-event"
targetid="my-component-id"/>
</foo:bar>
处理程序不必在元素内:
The handler doesn't have to be within the element:
<foo:bar id="my-component-id" bind="my-bind"/>
<xf:dispatch
event="fr-data-save-done"
observer="fr-form-model"
name="my-custom-event"
targetid="my-component-id"/>
在XBL组件内部:
<xbl:binding id="my-binding-id" element="foo:bar">
<xbl:handlers>
<xbl:handler event="my-custom-event" phase="target">
... XForms actions here ...
</xbl:handler>
</xbl:handlers>
...
</xbl:binding>
这篇关于在Form Builder中捕获保存事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!