Domanda

I am trying to launch a javascript for adding extra functionality to a form run. The script must be launch when the form is loaded.

The idea is:

 <xxf:script ev:event="xforms-enabled">
         alert('hello world');           
 </xxf:script>

The problem is, as described at the Orbeon Forum, the "xforms-enabled" event is launched several times (for each control and variable). In the forum is described some workarounds and solutions, but cannot be applied when using javascript (or I do not know how to do it).

The question is: how can I execute the javascript code only one time when starting the form? Must I use another event?

È stato utile?

Soluzione

The best would be to run your script on xforms-ready, which is dispatched to the model. So you would put, inside your <xf:model>:

<xxf:script ev:event="xforms-ready">...</xxf:script>
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top