To download the full code sample see our Code Share site.
Fields enable the placement of additional data in a document at the time of signing. Like signature fields, non-signature fields can be placed anywhere inside a document. Nonetheless, each field is linked to a particular signature. Only the signer of that signature can assign or change the field's value. Once the signature is signed, however, the value of the field cannot be changed by anyone.
You cannot add fields to: (1) documents that are Accept Only; (2) the Electronic Consent form; (3) documents in an accessible transaction.
Adding a Field to a Document
To add a field on a document, you will first need to create your Field object using the OneSpan Sign FieldBuilder. The following code will do this:
Field field = FieldBuilder.label() .withId(new FieldId("myLabelField")) .withValue("Example label field value") .atPosition(100, 200) .onPage(0) .build();
Then, using the OneSpan SignApprovalService, add your field to your document. Use the Field object, PackageID, SignatureID, and documentID as parameters. The following code will do this:
String labelFieldId = client.getApprovalService().addField(packageId, "sample-contract", signatureid, field);
Updating a Field in a Document
It is important to note that when updating a field, your new Field object must have the same id as the field you want to update.
The following code will do this:
Field updatedField = FieldBuilder.signatureDate() .onPage(0) .withId(new FieldId("myLabelField")) .atPosition(100, 200) .build(); client.getApprovalService().updateField(packageId, "sample-contract", new SignatureId("ExampleSignatureId"), updatedField);
Deleting a Field in a Document
To delete a field, use the OneSpan SignApprovalService. Use the Field object, PackageID, SignatureID, and documentID as parameters. The following code will do this:
client.getApprovalService().deleteField(packageId, "sample-contract", new SignatureId("ExampleSignatureId"), new FieldId("myLabelField"));
Results
Once you have run your code, your fields will appear in your transaction's documents.
To download the full code sample see our Code Share site.
Fields enable the placement of additional data in a document at the time of signing. Like signature fields, non-signature fields can be placed anywhere inside a document. Nonetheless, each field is linked to a particular signature. Only the signer of that signature can assign or change the field's value. Once the signature is signed, however, the value of the field cannot be changed by anyone.
You cannot add fields to: (1) documents that are Accept Only; (2) the Electronic Consent form; (3) documents in an accessible transaction.
Adding a Field to a Document
To add a field on a document, you will first need to create your Field object using the OneSpan Sign FieldBuilder, as shown below.
Field field = FieldBuilder.Label() .WithId("myLabelField") .WithValue("Example label field value") .AtPosition(100, 200) .OnPage(0) .Build();
Then, using the OneSpan SignApprovalService, add your field to your document. Use the Field object, PackageID, SignatureID, and documentID as parameters. The following code will do this:
string labelFieldId = client.ApprovalService.AddField(packageId, "sample-contract", signatureid, field);
Updating a Field in a Document
It is important to note that when updating a field, your new Field object must have the same id as the field you want to update.
The following code will do this:
Field updatedField = FieldBuilder.SignatureDate() .OnPage(0) .WithId("myLabelField") .AtPosition(100, 200) .Build(); client.ApprovalService.ModifyField(packageId, "sample-contract", new SignatureId("ExampleSignatureId"), updatedField);
Deleting a Field in a Document
To delete a field, use the OneSpan SignApprovalService. Use the Field object, PackageID, SignatureID, and documentID as parameters. The following code will do this:
client.ApprovalService.DeleteField(packageId, "sample-contract", new SignatureId("ExampleSignatureId"), "myLabelField");
Results
Once you have run your code, your fields will appear in your transaction's documents.
To download the full code sample see our Code Share site.
Fields enable the placement of additional data in a document at the time of signing. Like signature fields, non-signature fields can be placed anywhere inside a document. Nonetheless, each field is linked to a particular signature. Only the signer of that signature can assign or change the field's value. Once the signature is signed, however, the value of the field cannot be changed by anyone.
You cannot add fields to: (1) documents that are Accept Only; (2) the Electronic Consent form; (3) documents in an accessible transaction.
Adding a Field to a Document
The sample request below shows you how to add a field to an existing document:
HTTP Request
POST /api/packages/{packageId}/documents/{documentId}/approvals/{approvalId}/fields
HTTP Headers
Accept: application/json; esl-api-version=11.21 Content-Type: application/json Authorization: Basic api_key
Request Payload
{ "name":"Signer Name", "top":500, "left":300, "width":100, "height":30, "page":0, "type":"INPUT", "value":null, "binding":"{signer.name}", "subtype":"LABEL" }
For a complete description of each field, see the Request Payload table below.
Response Payload
{ "binding": "{signer.name}", "validation": null, "id": "BsZv3XvmpsMH", "page": 0, "data": null, "subtype": "LABEL", "top": 500, "height": 30, "extractAnchor": null, "width": 100, "extract": false, "left": 300, "type": "INPUT", "value": "{signer.name}", "name": "Signer Name" }
Refer to Release Note 10.6.1 for reason carrying esl-api-version in the request header.If you want an example of a basic document package creation for comparison, you can follow this guide.
Updating a Field in a Document
It is important to note that when updating a field, your new Field object must have the same id as the field you want to update.
To update a field, you will need to make a PUT request to:
https://sandbox.esignlive.com/api/packages/{packageId}/documents/{documentId}/approvals/{signatureId}/fields/{fieldId}
With the updated field parameters:
{ "id": "myLabelField", "top": 200, "left": 100, "width": 250, "height": 50, "page": 0, "type": "INPUT", "binding": "{approval.signed}", "subtype": "LABEL" }
Deleting a Field in a Document
Deleting a field is done by making a DELETE request to:
https://sandbox.esignlive.com/api/packages/{packageId}/documents/{documentId}/approvals/{signatureId}/fields/{fieldId}
Results
Once you have run your code, your fields will appear in your transaction's documents.
Request Payload Table
Property | Type | Editable | Required | Default | Sample Values |
---|---|---|---|---|---|
name | string | Yes | No | n/a | Signer Name |
top | integer | Yes | No | 0 | 500 |
left | integer | Yes | No | 0 | 300 |
width | integer | Yes | No | 200 | 100 |
height | integer | Yes | No | 50 | 30 |
page | integer | Yes | No | 0 | 0 / 1 / 2 ... |
type | string | Yes | No | n/a | SIGNATURE / INPUT |
value | string | Yes | No | null | STU BANK |
subtype | string | Yes | No | n/a | FULLNAME / INITIALS / CAPTURE / LABEL / TEXTFIELD / TEXTAREA / CHECKBOX / RADIO / LIST |
binding | string | Yes | No | null | {approval.signed} / {signer.title} / {signer.name} / {signer.company} |
To download the full code sample see our Code Share site.
Fields enable the placement of additional data in a document at the time of signing. Like signature fields, non-signature fields can be placed anywhere inside a document. Nonetheless, each field is linked to a particular signature. Only the signer of that signature can assign or change the field's value. Once the signature is signed, however, the value of the field cannot be changed by anyone.
You cannot add fields to: (1) documents that are Accept Only; (2) the Electronic Consent form; (3) documents in an accessible transaction.
Adding a Field to a Document
To add a field on a document, you will first need to build your Field object as shown below.
//create field to an existing approval ESignLiveAPIObjects.Field label_field = new ESignLiveAPIObjects.Field(); label_field.id = 'label_field'; label_field.type = 'INPUT'; label_field.subtype = 'LABEL'; label_field.value = 'old label value'; label_field.page = 0; label_field.top = 100.0; label_field.left = 50.0; label_field.width = 150.0; label_field.height = 50.0;
Then, using the addField function, add your field to your document. Use the Field object, PackageID, ApprovalID, and documentID as parameters. The following code will do this:
//String packageId, String documentId, String approvalId, ESignLiveAPIObjects.Field fieldToCreate String label_field_response = sdk.addField('yjn7R9GyKU_BRhUjvLrWFp5vUEA=','f3e381eec45b4df851bd28087ad12104c620814bccca6b76','8ELNXeOxMHsD',label_field); label_field = (ESignLiveAPIObjects.Field)JSON.deserialize(label_field_response, ESignLiveAPIObjects.Field.class);
Updating a Field in a Document
It is important to note that when updating a field, your new Field object must have the same id as the field you want to update.
The following code will do this:
//update field //String packageId, String documentId, String approvalId, String fieldId, ESignLiveAPIObjects.Field fieldToUpdate label_field.value = 'changed label value'; sdk.updateField('yjn7R9GyKU_BRhUjvLrWFp5vUEA=','f3e381eec45b4df851bd28087ad12104c620814bccca6b76','8ELNXeOxMHsD',label_field.id,label_field);
Deleting a Field in a Document
To delete a field, use the OneSpan SignApprovalService. Use the Field object, PackageID, SignatureID, and documentID as parameters. The following code will do this:
//delete field //String packageId, String documentId, String approvalId, String fieldId sdk.deleteField('yjn7R9GyKU_BRhUjvLrWFp5vUEA=','f3e381eec45b4df851bd28087ad12104c620814bccca6b76','8ELNXeOxMHsD',label_field.id);
Results
Once you have run your code, your fields will appear in your transaction's documents.