PrizmDoc® Viewer v14.0 Release - Updated
PrizmDoc Viewer / Developer Guide / Viewer / Legacy Windows Viewers / Customize the E-Signature Viewers / Fill in Fields Programmatically
In This Topic
    Fill in Fields Programmatically
    In This Topic


    The StateModified event fires when fields are filled in and the ModifyState event can be used to update filled-in field values.

    The example below demonstrates using a StateModified event handler to get the filled-in values of two fields and fire the ModifyState event to fill in a third field with the sum:


    viewer.eventStore.on('StateModified', function (ev, data) {
       if (data.state === 'FieldList') {
           var value1 = parseInt(data.stateValue.fieldList\[1\].value);
           var value2 = parseInt(data.stateValue.fieldList\[2\].value);
           data.stateValue.fieldList\[3\].value = (value1 + value2).toString();
           viewer.eventStore.trigger('ModifyState', {
              state: 'FieldList',
              stateValue: data.stateValue