Data fields
To include data from the library's internal state or status in the HTML content, the data-dw-data attribute is used. Elements with this tag
will have their content substituted with the value specified.
There may be a momentarily delay before the value is substituted, so a suitable placeholder should be included in the HTML. The entire content of the element is replaced.
<span data-dw-data="source.manipulating">[Loading]</span>
Attribute selectors can be used to customise the content shown based on the status of the library. The example below pins the interface to the bottom of the screen on mobile devices once one or more data sources have been added.
@media only screen and (max-width: 800px) {
[data-dw-source-count]:not([data-dw-source-count='0']) .dw-controller-inline {
position: fixed !important;
width: 100vw !important;
left: 0 !important;
bottom: 0 !important;
}
}
Options
The data described in the table below can be used both as an output option, by setting the data-dw-data attribute on an element, or as an attribute selector within stylesheets.
All HTML associated with the library is injected within a single element with the ID datawollet-root. This element has the data attributes listed below.
Some of the values would not ordinarily be used as output data and exposed to the user, but are shown for completeness.
data-dw-data value | Parent data attribute | Description |
|---|---|---|
interface | data-dw-interface | Whether the inline interface for the library is expanded or collapsed. |
activity | data-dw-activity | The overall activity status, which is idle, prefilling, filling or uploading. |
interaction | data-dw-interaction | Whether the user is being asked to interact with the interface, either none or confirming. |
capability.scan | data-dw-capability-scan | Whether the scan capability is available based on the device and browser data known. This may change after attempting to initialise a scan. |
source.count | data-dw-source-count | The total number of sources added. |
source.error | data-dw-source-error | The error associated with a source, if any, as described in the table below. |
source.manipulating | data-dw-source-manipulating | The file name of a source being manipulated, used when confirming the removal of a source through interaction. |
fill.expected | data-dw-fill-expected | The total number of auto-filled fields expected. This number may not be exact as some auto-fills cannot be precalculated, when they depend on the options available. |
drop.active | data-dw-drop-active | Whether a file is being dragged over the drop area. |
drop.permitted | data-dw-drop-permitted | Whether the file being dragged over the drop area is allowed, and would be uploaded if dropped. |
Possible values for source error
source.error | Description |
|---|---|
file-type | Source is not of the correct type (e.g. PDF). This error is uncommon as the file picker and drop zone both check file types before accepting input. |
file-parse | Source could not be read (e.g. corrupt). |
file-size | Source is too large (~4.5MB limit per request). |
source-unexpected | Source was classified as a data source that isn't listed as an expected type (e.g. bill provided when identity document expected). |
source-unmatched | Source document type could not be determined (not in library). |
source-lacking | Source was processed successfully but no data was extracted. |
server-error | Server returned an error not otherwise described. Retrying could be recommended. |
server-timeout | Server did not respond within the configured timeout. Document could be too large or the internet connection poor. |
server-forbidden | Server submission was blocked or rejected. Could be a result of network restrictions or browser restrictions. |
scan-capability | Scanning capability is not an option with the browser or hardware available. |
scan-permission | Permissions required were not granted by the user, such as access to the camera. |
scan-quality | Scan seems to be of poor quality and might not be able to be used. Retrying could be recommended with further guidance. |