DocuVieware Reference Guide
Reference Guides > JavaScript API > Events > RegisterOnFormFieldChanged

This function allows you to trigger a function of your own when a form field value has been changed.

RegisterOnFormFieldChanged: function (docuViewareID, callback)


The identifier for the DocuVieware™ instance.
The function you want to execute on event.
The callback provides an argument having a prototype { id, pageNo}.
- id specifies the form field id.
- pageNo is the page number the form field that has been changed is on.

Return Value

1 if error.

Example of usage

This JavaScript makes sure the DocuVieware control is properly loaded and initialized and then subscribes to the event on load.

function RegisterOnFormFieldChangedOnDocuViewareAPIReady() {
    if (typeof DocuViewareAPI !== "undefined" && DocuViewareAPI.IsInitialized("DocuVieware1")) {
        DocuViewareAPI.RegisterOnFormFieldChanged("DocuVieware1", function (field) { console.log(field); });
    else {
        setTimeout(function () { RegisterOnFormFieldChangedOnDocuViewareAPIReady() }, 10);
document.addEventListener("DOMContentLoaded", function () {
}, false);