In This Topic
Reference Guides / JavaScript API / Events / RegisterOnFormFieldChanged

RegisterOnFormFieldChanged

In This Topic
 RegisterOnFormFieldChanged

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

RegisterOnFormFieldChanged: function (docuViewareID, callback)

Parameters

docuViewareID
The identifier for the DocuVieware™ instance.
callback
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 () {
    RegisterOnFormFieldChangedOnDocuViewareAPIReady();
}, false);