How to submit your form in FormVu?
FormVu provides the FormVuAPI JavaScript API to assist with submitting your filled PDF form data. At present, this works in AcroForm files and there are three outputs supported:
- Form Data
- JSON
- XML
How to access the FormVuAPI JavaScript API
See our related FAQ on how to access the FormVuAPI
Submit as Form Data:
To output the form data in the same format as an HTML Form, you can use the following JavaScript:
FormVuAPI.submitFormAsFormData('INSERT-URL-HERE');
This submission uses a POST request containing all form fields of the converted document. This includes the field names and their values.
It uses the same format an HTML form would use if the encoding type were set to “multipart/form-data”.
Submit as JSON:
To output the form data as JSON, you can use the following JavaScript:
FormVuAPI.submitFormAsJSON('INSERT-URL-HERE');
This will send the form data to the URL specified as a POST request.
The output JSON that is sent across is available in the following format:
{
data: {
"form-key-a": "form-value-a",
"form-key-b": "form-value-b"
}
}
Submit as XML:
To output the form data as XML, you can use the following JavaScript:
FormVuAPI.submitFormAsXML('INSERT-URL-HERE');
This will send the form data to the URL specified as a POST request.
The output XML that is sent across is available in the following format:
<?xml version='1.0' encoding='UTF-8'?>
<fields xmlns:xfdf="http://ns.adobe.com/xfdf-transition/">
<fieldName>value</fieldName>
<sanitised-field-name xfdf:original="sanitised field name">value</sanitised-field-name>
<field xfdf:original="very >bad< variable name">value</field>
<listBoxVariable>
<value>value1</value>
<value>value2</value>
</listBox>
<group xfdf:original="very >bad< listbox name">
<value>value1</value>
<value>value2</value>
</group>
</fields>
The fields are wrapped in a fields
element.
Each element within the fields
element represents a field, where the element’s name is either:
- The field name.
- The sanitised field name (when the field name contains some special characters).
- Exactly
group
if a multi list box, orfield
in all other cases.
The sanitised field name has some special characters removed, as well as spaces replaced with dashes.
When the field name has been sanitised or replaced with group
/field
, there will be an attribute called: xfdf:original
which contains the original field name, with special symbols encoded as HTML character entries.
The value of the field is usually contained within the element as text, except for multi-list boxes, where the values are contained within value
elements.