Articles in this section
Category / Section

Default value and Read-Only mode must match for synced fields

Published:
12 mins read

You may encounter the following error when working with BoldSign templates:

The default value and read-only mode should be the same for same data synced fields

This occurs when multiple form fields in your template that are synchronized using the same dataSyncTag have mismatched default values or ReadOnly settings.

Cause

All form fields linked by the same dataSyncTag must have:

  • The same default value
  • The same ReadOnly status (true or false)

Any mismatch between these fields will trigger a validation error during document creation.

Resolution steps

To resolve this issue, ensure that all form fields associated with the same dataSyncTag have:

  • Identical default values
  • Matching ReadOnly settings

Update your template and request payload to reflect these values consistently.

Example

To synchronize two textboxes:

  • Assign the same dataSyncTag (e.g., "amount")
  • Set the same default value (e.g., "500")
  • Ensure both fields have the same ReadOnly setting (true or false)

Once properly configured, when a user inputs data into one of the linked fields, the data will be automatically populated in all the other linked fields.

Sample JSON snippet

Here are sample code snippets to demonstrate this:
cURL

curl -X 'POST' \
  'https://api.boldsign.com/v1/template/send?templateId=b8085b47-63b3-47f8-8d5e-cb0acfe2d916' \
  -H 'accept: application/json' \
  -H 'X-API-KEY: {your API key}' \
  -H 'Content-Type: application/json;odata.metadata=minimal;odata.streaming=true' \
  -d '{
    "Title": "Invitation form",
    "Message": "Kindly review and sign this.",
    "Roles": [
      {
        "RoleIndex": 1,
        "SignerName": "Richard",
        "SignerOrder": 1,
        "SignerEmail": "richard@cubeflakes.com",
        "PrivateMessage": "Please check and sign the document.",
        "EnableEmailOTP": false,
        "SignerType": "Signer",
        "SignerRole": "Manager",
        "ExistingFormFields": [
          {
            "id": "TextBox1",
            "name": "TextBox1",
            "fieldType": "TextBox",
            "pageNumber": 1,
            "bounds": {
              "x": 100,
              "y": 100,
              "width": 125,
              "height": 25
            },
            "isReadOnly": false,
            "value": "500",
            "dataSyncTag": "Amount"
          },
          {
            "id": "TextBox2",
            "name": "TextBox2",
            "fieldType": "TextBox",
            "pageNumber": 1,
            "bounds": {
              "x": 200,
              "y": 200,
              "width": 125,
              "height": 25
            },
            "isReadOnly": false,
            "value": "500",
            "dataSyncTag": "Amount"
          }
        ]
      }
    ]
  }'

.NET

var apiClient = new ApiClient("YOUR_API_KEY");
var templateClient = new TemplateClient(apiClient);

var sendForSignFromTemplate = new SendForSignFromTemplate
{
    TemplateId = "YOUR_TEMPLATE_ID",
    Roles = new List<Roles>
    {
        new Roles
        {
            RoleIndex = 1,
            SignerName = "David",
            SignerEmail = "david@cubeflakes.com",
            SignerType = SignerType.Signer
        }
    },
    ExistingFormFields = new List<ExistingFormField>
    {
        new ExistingFormField
        {
            Id = "TextBox1",
            Name = "TextBox1",
            FieldType = FieldType.TextBox,
            PageNumber = 1,
            Bounds = new Bounds
            {
                X = 100,
                Y = 100,
                Width = 125,
                Height = 25
            },
            IsReadOnly = false,
            Value = "500",
            DataSyncTag = "Amount"
        },
        new ExistingFormField
        {
            Id = "TextBox2",
            Name = "TextBox2",
            FieldType = FieldType.TextBox,
            PageNumber = 1,
            Bounds = new Bounds
            {
                X = 200,
                Y = 200,
                Width = 125,
                Height = 25
            },
            IsReadOnly = false,
            Value = "500",
            DataSyncTag = "Amount"
        }
    }
};

var documentCreated = templateClient.SendUsingTemplate(sendForSignFromTemplate);

Python

import boldsign

configuration = boldsign.Configuration(api_key="Your API Key")

with boldsign.ApiClient(configuration) as api_client:

    template_api = boldsign.TemplateApi(api_client)

    existing_form_fields = [
        boldsign.ExistingFormField(
            id="TextBox1",
            name="TextBox1",
            fieldType="TextBox",
            pageNumber=1,
            bounds={
                "x": 100,
                "y": 100,
                "width": 125,
                "height": 25
            },
            isReadOnly=False,
            value="500",
            dataSyncTag="Amount"
        ),
        boldsign.ExistingFormField(
            id="TextBox2",
            name="TextBox2",
            fieldType="TextBox",
            pageNumber=1,
            bounds={
                "x": 200,
                "y": 200,
                "width": 125,
                "height": 25
            },
            isReadOnly=False,
            value="500",
            dataSyncTag="Amount"
        )
    ]

    role = boldsign.Role(
        roleIndex=1,
        signer_name="Richard",
        signer_email="richard@cubeflakes.com",
        signerOrder=1,
        privateMessage="Please check and sign the document.",
        enable_email_otp=False,
        signerType="Signer",
        signerRole="Manager",
        existing_form_fields=existing_form_fields,
        locale="EN"
    )

    send_request = boldsign.SendForSignFromTemplateForm(
        title="Invitation form",
        message="Kindly review and sign this.",
        roles=[role]
    )

    response = template_api.send_using_template(
        template_id="560f8e8d-0359-4a2b-9cc7-e2b0e5c410e5",
        send_for_sign_from_template_form=send_request
    )

    print("Document ID:", response.document_id)

PHP

<?php
require_once "vendor/autoload.php";

use BoldSign\Configuration;
use BoldSign\Api\TemplateApi;
use BoldSign\Model\FormField;
use BoldSign\Model\Rectangle;
use BoldSign\Model\Role;
use BoldSign\Model\SendForSignFromTemplateForm;

$config = new Configuration();
$config->setApiKey('Your API Key'); 

$templateApi = new TemplateApi($config);
$textBox1 = new FormField();
$textBox1->setId('TextBox1');
$textBox1->setName('TextBox1');
$textBox1->setFieldType('TextBox');
$textBox1->setPageNumber(1);
$textBox1->setBounds(new Rectangle([
    'x' => 150,
    'y' => 150,
    'width' => 125,
    'height' => 25
]));
$textBox1->setIsReadOnly(false);
$textBox1->setValue('500');
$textBox1->setDataSyncTag('Amount');

$textBox2 = new FormField();
$textBox2->setId('TextBox2');
$textBox2->setName('TextBox2');
$textBox2->setFieldType('TextBox');
$textBox2->setPageNumber(1);
$textBox2->setBounds(new Rectangle([
    'x' => 200,
    'y' => 200,
    'width' => 125,
    'height' => 25
]));
$textBox2->setIsReadOnly(false);
$textBox2->setValue('500');
$textBox2->setDataSyncTag('Amount');

$role = new Role();
$role->setRoleIndex(1); 
$role->setSignerName('Richard');
$role->setSignerEmail('richard@cubeflakes.com');
$role->setSignerType("Signer");
$role->setFormFields([$textBox1, $textBox2]);

$sendRequest = new SendForSignFromTemplateForm();
$sendRequest->setRoles([$role]);

$response = $templateApi->sendUsingTemplate('Your templateID', $sendRequest);

print_r($response);

Java

ApiClient apiClient = Configuration.getDefaultApiClient();
        apiClient.setApiKey("Your API Key"); 
        TemplateApi templateApi = new TemplateApi(apiClient);

        try {
            FormField formField1 = new FormField();
            formField1.setId("TextBox1");
            formField1.setName("TextBox1");
            formField1.setFieldType(FormField.FieldTypeEnum.TEXT_BOX);
            formField1.setPageNumber(1);
            Rectangle bounds1 = new Rectangle();
            bounds1.setX(150f);
            bounds1.setY(150f);
            bounds1.setWidth(125f);
            bounds1.setHeight(25f);
           formField1.setBounds(bounds1);
            formField1.setIsReadOnly(false);
            formField1.setValue("500");
            formField1.setDataSyncTag("Amount");
            
            FormField formField2 = new FormField();
            formField2.setId("TextBox2");
            formField2.setName("TextBox2");
            formField2.setFieldType(FormField.FieldTypeEnum.TEXT_BOX);
            formField2.setPageNumber(1);
            Rectangle bounds2 = new Rectangle();
            bounds2.setX(200f);
            bounds2.setY(200f);
            bounds1.setWidth(125f);
            bounds2.setHeight(25f);
            formField2.setBounds(bounds2);
            formField2.setIsReadOnly(false);
            formField2.setValue("500");
            formField2.setDataSyncTag("Amount");

            Role role = new Role();
            role.setRoleIndex(1); 
            role.setSignerName("Richard");
            role.setSignerEmail("cathysam@cubeflakes.com");
            role.setSignerType(Role.SignerTypeEnum.SIGNER);
            role.setFormFields(Arrays.asList(formField1, formField2));

            SendForSignFromTemplateForm sendForm = new SendForSignFromTemplateForm();
            sendForm.setRoles(Arrays.asList(role));


            templateApi.sendUsingTemplate("Your templateID", sendForm);       System.out.println("Document sent successfully.");
        } catch (ApiException e) {
            System.err.println("Error message: " + e.getMessage());
        }
    }
}

Node.js

import { TemplateApi, FormField, Rectangle, Role, SendForSignFromTemplateForm } from "boldsign";

const templateApi = new TemplateApi();
templateApi.setApiKey("Your API Key");

const formField1 = new FormField();
formField1.id = "TextBox1";
formField1.name = "TextBox1";
formField1.fieldType = FormField.FieldTypeEnum.TextBox;
formField1.pageNumber = 1;
formField1.bounds = new Rectangle(100, 100, 125, 25);
formField1.isReadOnly = false;
formField1.value = "500";
formField1.dataSyncTag = "Amount";

const formField2 = new FormField();
formField2.id = "TextBox2";
formField2.name = "TextBox2";
formField2.fieldType = FormField.FieldTypeEnum.TextBox;
formField2.pageNumber = 1;
formField2.bounds = new Rectangle(200, 200, 125, 25);
formField2.isReadOnly = false;
formField2.value = "500";
formField2.dataSyncTag = "Amount";

const role = new Role();
role.roleIndex = 1;
role.signerName = "Richard";
role.signerEmail = "cathysam@cubeflakes.com";
role.signerOrder = 1;
role.signerType = Role.SignerTypeEnum.Signer;
role.signerRole = "Manager";
role.privateMessage = "Please check and sign the document.";
role.enableEmailOtp = false;
role.existingFormFields = [formField1, formField2];
role.locale = "EN";

const sendForSignFromTemplate = new SendForSignFromTemplateForm();
sendForSignFromTemplate.title = "Invitation form";
sendForSignFromTemplate.message = "Kindly review and sign this.";
sendForSignFromTemplate.roles = [role];

const run = async () => {
    try {
        const response = await templateApi.sendUsingTemplate("7f29bb2b-b9d8-4420-8a94-5d1372106fab", sendForSignFromTemplate);
        console.log("Document ID:", response?.body?.documentId || response?.documentId);
    } catch (error) {
        console.error("Error:", error.message || error);
    }
};

run();

In the provided code examples, assigning the same value such as “500” to the dataSyncTag property of both textboxes, along with setting the ReadOnly property to either true or false consistently, enables automatic synchronization between them. This allows users to input data in one textbox, which is instantly mirrored in the other, ensuring data consistency.

Was this article useful?
Like
Dislike
Help us improve this page
Please provide feedback or comments
Access denied
Access denied