How to access the FormVuAPI JavaScript API
What is the FormVuAPI?
The FormVuAPI can be used for:
It is provided in JavaScript, is available from the DOM window object, and can be accessed as you would expect for most JavaScript calls.
Console (Development/Testing Only)
The easiest way to access the JavaScript for a converted file would be with your browsers JavaScript Console). Note: any changes made will be lost on refresh of the page.
All you need to do is open “Developer Tools”, select the “Console” tab, type in the JavaScript, and press enter to execute it.
Edit form.html
You can edit the form.html file directly. The simplest use-case would be to edit the onclick
attribute of the Submit Form Button (found in the <div id="FDFXFA_Menu">
element).
For example:
<a title="Submit Form" onclick="FormVuAPI.submitFormAsFormData('INSERT-URL-HERE')">
<script> tags
Adding in a JavaScript <script>
tag is also a method that would allow for you to access the FormVuAPI. Using the defer
attribute is advised to ensure that the form has fully loaded before running your custom code.
For example:
<script defer>
FormVuAPI.submitFormAsFormData('INSERT-URL-HERE');
</script>
iframe
To access the content when the FormVu output is in an iframe, you can either:
- Select the element and access it via the
contentWindow
attribute, e.g.document.getElementById('iframe-id-here').contentWindow.FormVuAPI.submitFormAsFormData('INSERT-URL-HERE');
- Access it via
window.frames
. For example, if it’s the only iframe on the page, you could use:window.frames[0].FormVuAPI.submitFormAsFormData('INSERT-URL-HERE');