How to add checkbox form field to the document via BoldSign API?
BoldSign supports the functionality to include checkboxes in your documents prior to sending them to the signer. This feature enables the signer to conveniently select one or more options from a provided list by simply clicking on the checkboxes. This enhances the efficiency and clarity of the document signing process, making it easier for all parties involved to communicate their preferences or choices effectively.
Send a document to the signer with Checkbox fields:
To send a document with a checkbox, set the fieldType
as CheckBox
.
Here are some example codes you can use to set checkbox form fields:
Code snippet
cURL
curl -X 'POST' \
'https://api.boldsign.com/v1/document/send' \
-H 'accept: application/json' \
-H 'X-API-KEY: {your API key}' \
-H 'Content-Type: multipart/form-data' \
-F 'Title="Sample Document"' \
-F 'Signers={
"name": "hanky",
"emailAddress": "hankyWhites@gmail.com",
"signerType": "Signer",
"signerRole": "Signer",
"formFields": [
{
"id": "CheckBox",
"name": "CheckBox",
"fieldType": "CheckBox",
"pageNumber": 1,
"bounds": {
"x": 200,
"y": 200,
"width": 25,
"height": 25
},
"isRequired": true
}
],
"locale": "EN"
}' \
-F 'Files=@{your file}' \
C#
var apiClient = new ApiClient("https://api.boldsign.com", "{Your API key}");
var documentClient = new DocumentClient(apiClient);
var documentFilePath = new DocumentFilePath
{
ContentType = "application/pdf",
FilePath = "{Your File path}"
};
var filesToUpload = new List<IDocumentFile>
{
documentFilePath,
};
var checkboxField = new FormField(
id: "CheckBox",
type: FieldType.CheckBox,
isRequired: true,
pageNumber: 1,
bounds: new Rectangle(x: 200, y: 200, width: 25, height: 25));
var formFieldCollections = new List<FormField>()
{
checkboxField
};
var signer = new DocumentSigner(
signerName: "David",
signerType: SignerType.Signer,
signerEmail: "david@cubeflakes.com",
formFields: formFieldCollections,
locale: Locales.EN);
var documentSigners = new List<DocumentSigner>()
{
signer
};
var sendForSign = new SendForSign()
{
Signers = documentSigners,
Title = "Sample Document",
Files = filesToUpload
};
var documentCreated = documentClient.SendDocument(sendForSign);
Python
import boldsign
configuration = boldsign.Configuration(
api_key = "YOUR_API_KEY"
)
with boldsign.ApiClient(configuration) as api_client:
document_api = boldsign.DocumentApi(api_client)
send_for_sign = boldsign.SendForSign(
title="Document SDK API",
document_title = "SDK Document Test case",
description="Testing document from SDK integration test case",
files=["YOUR_FILE_PATH"],
signers=[
boldsign.DocumentSigner(
name="Hanky",
emailAddress="hankyWhites@cubeflakes.com",
signerOrder=1,
signerType="Signer",
formFields=[
boldsign.FormField(
name="CheckBox",
fieldType="CheckBox",
font="Helvetica",
pageNumber=1,
isRequired=True,
bounds=boldsign.Rectangle(x=50, y=50, width=100, height=150)
)
],
privateMessage="This is private message for signer"
)
]
)
send_document_response = document_api.send_document(send_for_sign)
NodeJS
const axios = require('axios');
const FormData = require('form-data');
const fs = require('fs');
let data = new FormData();
data.append('Signers', '{\r\n "name": "hanky",\r\n "emailAddress": "hankyWhites@gmail.com",\r\n "signerType": "Signer",\r\n "signerRole": "Signer",\r\n "formFields": [\r\n {\r\n "id": "CheckBox",\r\n "name": "CheckBox",\r\n "fieldType": "CheckBox",\r\n "pageNumber": 1,\r\n "bounds": {\r\n "x": 200,\r\n "y": 200,\r\n "width": 25,\r\n "height": 25\r\n },\r\n "isRequired": true\r\n}\r\n ],\r\n "locale": "EN"\r\n}');
data.append('Files', fs.createReadStream('{Your file path}'));
data.append('Title', "Sample Document");
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://api.boldsign.com/v1/document/send',
headers: {
'accept': 'application/json',
'X-API-KEY': '{Your API key}',
...data.getHeaders()
},
data : data
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
In the above examples, make sure to replace fieldType
with CheckBox
. Execute the provided code, making sure to provide the necessary fields such as Files,
Title,
and Signers.
By doing so, the document will be sent to the signers with the checkbox, allowing them to make a selection when signing.