PrizmDoc v13.3 - Updated
Fill in Fields Programmatically
Developer Guide > Customize the E-Signature Viewers > Fill in Fields Programmatically

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:

Example
Copy Code
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
       });
    }
});