Skip to main content

Using an an SDK to create an envelope. I need to have 2 checkboxes and want client to only be able to choose exactly 1 of those 2 checkboxes. Tried doing something with the group, but it still allows having both empty.

 

function makeEnvelopeCDM(email: string, name: string, document: any) {

const docusignAny = docusign as any;

const env = new docusignAny.EnvelopeDefinition();

env.emailSubject = 'Please sign this document set';



let doc = new docusignAny.Document.constructFromObject({

documentBase64: document,

name: 'Installer Quotation',

fileExtension: 'pdf',

documentId: '1',

});



env.documents = doc];



let signer1 = docusignAny.Signer.constructFromObject({

email: email,

name: name,

recipientId: '1',

routingOrder: '1',

});



let signHere1 = docusignAny.SignHere.constructFromObject({

anchorString: 'Title',

anchorYOffset: '100',

anchorUnits: 'pixels',

anchorXOffset: '25',

});



let title = docusignAny.Title.constructFromObject({

anchorString: 'Title',

anchorYOffset: '0',

anchorUnits: 'pixels',

anchorXOffset: '45',

});



let dateSigned = docusignAny.DateSigned.constructFromObject({

anchorString: 'Title',

anchorYOffset: '56',

anchorUnits: 'pixels',

anchorXOffset: '24',

});



let nameTab = docusignAny.FullName.constructFromObject({

anchorString: 'Title',

anchorYOffset: '-25',

anchorUnits: 'pixels',

anchorXOffset: '17',

});



let checkboxTab1 = docusignAny.Checkbox.constructFromObject({

anchorString: 'Title',

anchorYOffset: '0',

anchorUnits: 'pixels',

anchorXOffset: '250',

tabLabel: 'Checkbox1',

});



let checkboxTab2 = docusignAny.Checkbox.constructFromObject({

anchorString: 'Title',

anchorYOffset: '26',

anchorUnits: 'pixels',

anchorXOffset: '250',

tabLabel: 'Checkbox2',

});



let checkboxGroup = docusignAny.TabGroup.constructFromObject({

groupLabel: 'CheckboxGroup',

tabScope: 'document',

minimumRequired: 1,

maximumAllowed: 1, 

// groupRule: 'SelectExactlyOne', 

tabs: scheckboxTab1, checkboxTab2],

});



let signer1Tabs = docusignAny.Tabs.constructFromObject({

signHereTabs: ssignHere1],

titleTabs: stitle],

dateSignedTabs: sdateSigned],

fullNameTabs: snameTab],

checkboxTabs: scheckboxTab1, checkboxTab2],

tabGroups: scheckboxGroup],

});



signer1.tabs = signer1Tabs;



let recipients = docusignAny.Recipients.constructFromObject({

signers: ssigner1],

});



env.recipients = recipients;

env.status = 'sent';



return env;

}

 

Hi ​@juurou 

To have 2 checkboxes and want the client to only be able to choose exactly 1 of those 2 checkboxes. Please uncomment groupRule in the checkboxGroup and use the value ‘SelectExactly’.


Nothing’s changed, even though I have changed my code to this

 

function makeEnvelopeCDM(email: string, name: string, document: any) {
const docusignAny = docusign as any;
const env = new docusignAny.EnvelopeDefinition();
env.emailSubject = 'Please sign this document set';

let doc = new docusignAny.Document.constructFromObject({
documentBase64: document,
name: 'Installer Quotation',
fileExtension: 'pdf',
documentId: '1',
});

env.documents = doc];

let signer1 = docusignAny.Signer.constructFromObject({
email: email,
name: name,
recipientId: '1',
routingOrder: '1',
});

let signHere1 = docusignAny.SignHere.constructFromObject({
anchorString: 'Title',
anchorYOffset: '100',
anchorUnits: 'pixels',
anchorXOffset: '25',
});

let title = docusignAny.Title.constructFromObject({
anchorString: 'Title',
anchorYOffset: '0',
anchorUnits: 'pixels',
anchorXOffset: '45',
});

let dateSigned = docusignAny.DateSigned.constructFromObject({
anchorString: 'Title',
anchorYOffset: '56',
anchorUnits: 'pixels',
anchorXOffset: '24',
});

let nameTab = docusignAny.FullName.constructFromObject({
anchorString: 'Title',
anchorYOffset: '-25',
anchorUnits: 'pixels',
anchorXOffset: '17',
});

let checkboxTab1 = docusignAny.Checkbox.constructFromObject({
anchorString: 'Title',
anchorYOffset: '0',
anchorUnits: 'pixels',
anchorXOffset: '250',
tabLabel: 'Checkbox1',
});

let checkboxTab2 = docusignAny.Checkbox.constructFromObject({
anchorString: 'Title',
anchorYOffset: '26',
anchorUnits: 'pixels',
anchorXOffset: '250',
tabLabel: 'Checkbox2',
});

let checkboxGroup = docusignAny.TabGroup.constructFromObject({
groupLabel: 'CheckboxGroup',
tabScope: 'document',
minimumRequired: 1,
maximumAllowed: 1,
groupRule: 'SelectExactly',
tabs: scheckboxTab1, checkboxTab2],
});

let signer1Tabs = docusignAny.Tabs.constructFromObject({
signHereTabs: ssignHere1],
titleTabs: stitle],
dateSignedTabs: sdateSigned],
fullNameTabs: snameTab],
checkboxTabs: scheckboxTab1, checkboxTab2],
tabGroups: scheckboxGroup],
});

signer1.tabs = signer1Tabs;

let recipients = docusignAny.Recipients.constructFromObject({
signers: ssigner1],
});

env.recipients = recipients;
env.status = 'sent';

return env;
}

 


@juurou The checkbox tabs are missing the property (tabGroupLabels) and TabGroup does not have the property (tabs). Please update your checkbox tabs and tab group as follows.

 

  let checkboxTab1 = docusignAny.Checkbox.constructFromObject({
anchorString: 'Title',
anchorYOffset: '0',
anchorUnits: 'pixels',
anchorXOffset: '250',
tabLabel: 'Checkbox1',
tabGroupLabels: b'CheckboxGroup']
});

let checkboxTab2 = docusignAny.Checkbox.constructFromObject({
anchorString: 'Title',
anchorYOffset: '26',
anchorUnits: 'pixels',
anchorXOffset: '250',
tabLabel: 'Checkbox2',
tabGroupLabels: b'CheckboxGroup']
});

let checkboxGroup = docusignAny.TabGroup.constructFromObject({
groupLabel: 'CheckboxGroup',
tabScope: 'document',
minimumRequired: '1',
maximumAllowed: '1',
groupRule: 'SelectExactly'
});

Please consult the blog below to learn more.

https://www.docusign.com/blog/developers/tabs-deep-dive-checkboxes-and-radio-groups


Reply