简体   繁体   English

事件xforms-model-construct-done行为

[英]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: 一些小意见:

  • you don't need to (in fact shouldn't) place event attributes on nested actions 您不需要(实际上不应该)将event属性放在嵌套动作上
  • you don't even need the ev prefix 您甚至不需要ev前缀

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 JavaScript异常后的HTML事件事件行为 - HTML on-event behaviour after JavaScript exception 如果未完成event.preventDefault(),则不会在on(&#39;submit&#39;)中执行console.log - console.log not executed in on('submit') if event.preventDefault() is not done 在event.preventDefault()之后如何在ajax .done()中提交表单? - How to submit a form in ajax .done() after event.preventDefault()? 如何优雅地为具有多态关联的 model 构建表单? - How can I elegantly construct a form for a model that has a polymorphic association? XLSForm、ODK XForm 和 XForms 是等效的吗? - Are XLSForm, ODK XForm and XForms equivalent? jQuery:在完成第一个事件之前,防止重新提交表单 - jquery: prevent resubmission of form until first one event is done 寻找表单文件传输完成事件! jQuery的ajax - looking for form file transfer done event! jquery ajax 我尝试用表格值调用模型时做错了什么 - what have i done wrong trying to call the model with form value 带有JavaScript的Xforms-确定复选框处于选中状态还是未选中状态 - Xforms with javascript - determine if checkbox is checked or unchecked XForms 是否仍然是一个正在实施和开发的标准,或者是否存在或正在开发的替代方案? - Is XForms still a standard that is being implemented and developed, or is there an alternative in place or being developed?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM