How can I call JavaScript code from an XForms action? -


i'm trying call javascript on button click in xform. seems easy task but... i've programmed described here , have added xml :

<xforms:trigger>     <xforms:label>increment foo javascript</xforms:label>     <xxforms:script ev:event="domactivate">         alert("test!")     </xxforms:script> </xforms:trigger> 

but error wher page has loaded :

fatal error: prefix "ev" attribute "ev:event" associated element type "xxforms:script" not bound

did miss thing?

this means namespace prefix ev not visible <xxforms:script> element.

as @grtjn mentions in comment, have add proper xml namespace declaration. example @ top of document:

<xhtml:html     xmlns:xhtml="http://www.w3.org/1999/xhtml"     xmlns:ev = "http://www.w3.org/2001/xml-events"     xmlns:xforms="http://www.w3.org/2002/xforms"     xmlns:xxforms="http://orbeon.org/oxf/xml/xforms">     <xhtml:head>         ... 

note in recent builds of orbeon forms, prefix on event attributes optional, can write things like:

<xxforms:script event="domactivate"> 

but might not supported other implementations.


Comments

Popular posts from this blog

jasper reports - Fixed header in Excel using JasperReports -

media player - Android: mediaplayer went away with unhandled events -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -