Hydromast
Hydromast

Reputation: 312

How Can Fields With Validation be Prefilled in DocuSign?

I have a field in my template that has validation for numbers only enabled. If I were to remove this validation, it would prefill the field on the document. Enabling it will not prefill that field. Is there a way to prefill validated fields?

I am using the latest version of DocuSign nuget package.

This is my code to prefill the data. It only works on non-validated fields.

var accountNumber = new Text
{
    TabLabel = "AccountNumber",
    Value = form.AccNo,

};
var tabList = new List<Text> {bankName, accountNumber, accountName};
formInfo.Tabs = new Tabs();
formInfo.Tabs.TextTabs = tabList;
envelope.TemplateRoles = new List<TemplateRole> { formInfo };
envelope.Status = "sent";
var summary = envelopesApi.CreateEnvelope(AccountID, envelope);

Upvotes: 1

Views: 327

Answers (1)

Drew
Drew

Reputation: 5029

When you enable Validation for a field, it actually changes the field type. Instead of a Text, that tag will now be a Number:

        var accountNumber = new DocuSign.eSign.Model.Number
        {
            TabLabel = "AccountNumber",
            Value = form.AccNo
        };

and it will need to go into a different Tabs list under your Recipient:

        signer.Tabs = new Tabs
        {
            TextTabs = new List<DocuSign.eSign.Model.Text>
            {
                bankName,
                accountName
            },
            NumberTabs = new List<DocuSign.eSign.Model.Number>
            {
                accountNumber
            }
        };

Other validation options can also change the tab type. Depending on what you're doing, you could be working with EmailTabs, DateTabs, SsnTabs or ZipTabs.

Upvotes: 3

Related Questions