I know we call invoke a JavaScript method using xf:load
in the xforms-ready
event of the model.
<xf:load resource="javascript:myFunction()" />
But how can I embed JavaScript? I.e. I want to dynamically generate javascript from a resource, embed it in an element and then invoke it using the method above?
If you're writing XForms "by hand", you can include your own JavaScript by adding a
<script>
inside the<head>
of your page. There is really nothing specific to XForms here. With Orbeon Forms, you would typically use thexh
prefix to denote this is something from HTML:If you're using Form Builder to create the form, then you'll want to use the
oxf.fr.js.custom.uri.*.*
property to reference JavaScript files to include.