Some test text!
Web / Guides
Starting in WebViewer 8, you can build and edit forms fields with an interactive form builder that is part of the UI. This form builder mode allows users to add new form fields, and edit existing fields by changing field names, required flags, as well as their size and position in the document. Users are also able to delete form fields. The FormFieldCreationManager also offers several APIs and events that allow developers to run custom logic.
Click Forms
in the header, which will activate form building mode.
While in this mode, all non-field annotations will be hidden. All existing form fields will be converted into annotations that will serve as placeholders for the actual fields. Any styles currently used by the form field will be carried on to its placeholder, with the exception of radio buttons or signature widgets which do not support styling. This means that if any of your form fields have a transparent border and fill, they will not be immediately visible while in form builder mode. In order to view all your form fields, you can open the notes panel to see all the fields present in the document.
In order to view or change the field information for each field, click on the annotation place holder and open the form field edit popup. The popup options will change depending on the type of field being edited.
Click Apply Fields
to finish editing and apply changes to the fields.
Currently, the form builder supports the creation six form fields, each with their corresponding tool:
To create a field simply select the tool, and draw an annotation. Using the form field popup you can then specify field name, and required flags.
Text fields can have a default value, as well as support for multi-line via field flags.
Starting in WebViewer 8.9, signature fields can be created to accept signatures or initials. Simply choose the required option in the dropdown. Please note that the initials feature must be enabled in order for this option to be displayed. For a sample on how to do this refer to this guide .
Signature widgets that are flagged as requiring initials will apply initials created by the user in the signature modal during the signing process.
In order to logically group radio buttons together, ensure that they all share the same field name.
Check boxes support two field flags: required and read only.
For list and combo box fields you can add as many options as you wish, and re-order them as needed. List box fields also have support for multiselection if this flag is enabled,
WebViewer provides some APIs and useful events for customizing the default behaviors.
Just like most of the other elements in the viewer, the Form
toolbar group has a data-element
associated with it, which means you can use disableElements
to remove it from the DOM.
WebViewer(...)
.then(instance => {
instance.UI.disableElements(['toolbarGroup-Forms']);
});
The FormFieldCreationManager
exposes the startFormFieldCreationMode and endFormFieldCreationMode function that can be used to programmatically toggle the form field creation mode. The isInFormFieldCreationMode function can be used to check if WebViewer is currently in the editing mode.
WebViewer(...)
.then(instance => {
instance.docViewer.addEventListener('annotationsLoaded', () => {
const formFieldCreationManager = instance.Core.annotationManager.getFormFieldCreationManager();
formFieldCreationManager.startFormFieldCreationMode();
formFieldCreationManager.isInFormFieldCreationMode(); // returns true
// ...
formFieldCreationManager.endFormFieldCreationMode();
});
});
The form field placeholder is the annotation that temporarily replaces a form field during form field creation mode. Several helper functions that are related to form field placeholders are also available to use. To see all the available APIs refer to the FormFieldCreationManager documentation.
WebViewer(...)
.then(instance => {
instance.Core.annotationManager.addEventListener('annotationChanged', (annotations) => {
const formFieldCreationManager = instance.Core.annotationManager.getFormFieldCreationManager();
if (!formFieldCreationManager.isInFormFieldCreationMode()) {
return;
}
const formFieldPlaceholders = annotations.filter((annotation) =>
annotation.isFormFieldPlaceholder()
);
});
});
The formFieldCreationModeStarted and formFieldCreationModeEnded events will be triggered when WebViewer enters and exits form field creation mode. They can be listened to in order to execute custom logic.
WebViewer(...)
.then(instance => {
const formFieldCreationManager = instance.Core.annotationManager.getformFieldCreationManager();
formFieldCreationManager.addEventListener('formFieldCreationModeStarted', () => {
// Form field creation mode started, run some custom logic...
});
formFieldCreationManager.addEventListener('formFieldCreationModeEnded', () => {
// Form field creation mode ended, run some custom logic...
});
});
Trial setup questions? Ask experts on Discord
Need other help? Contact Support
Pricing or product questions? Contact Sales