I’m trying to call a javascript on a button click in XForm. Seems to be an easy task but…
I’ve programmed everything as it is described here and have this added to my xml :
<xforms:trigger>
<xforms:label>Increment foo with JavaScript</xforms:label>
<xxforms:script ev:event="DOMActivate">
alert("Test!")
</xxforms:script>
</xforms:trigger>
But I get this error wher the page has loaded :
Fatal error: The prefix “ev” for attribute “ev:event” associated with an element type “xxforms:script” is not bound
Did I miss some thing?
This means that the namespace prefix
evis not visible from the<xxforms:script>element.As @grtjn mentions in his comment, you have to add the proper XML namespace declaration. For example at the top of your document:
Note that in recent builds of Orbeon Forms, the prefix on event attributes is now optional, so you can write things like:
But this might not be supported by other implementations.