cristinak
cristinak

Reputation: 43

DocuSign API - Is there a programmatic way to use Data Validation for Text Fields?

DocuSign API - Is there a programmatic way to use Data Validation for Text Fields as described here ?

I would like to specify on a com.docusign.esign.model.Text field that it should accept only a valid format SSN, ZIP or Email.

Has anyone found a way to do that without regex?

Upvotes: 1

Views: 305

Answers (1)

Praveen Reddy
Praveen Reddy

Reputation: 7393

You can directly use the Email/SSN/Zip tabs provided in the SDK

See the API Recipe here and add the following tab creation logic.

Here is a sample code

 Tabs tabs = new Tabs();

 //SSN Tabs
 Ssn ssn = new Ssn();
 ssn.setDocumentId("1");
 ssn.setPageNumber("1");
 ssn.setRecipientId("1");
 ssn.setXPosition("100");
 ssn.setYPosition("100");

 List<Ssn> ssnTabs = new ArrayList<Ssn>();      
 ssnTabs.add(ssn);
 tabs.setSsnTabs(ssnTabs);


 //Zip Tabs
 Zip zip = new Zip();
 zip.setDocumentId("1");
 zip.setPageNumber("1");
 zip.setRecipientId("1");
 zip.setXPosition("200");
 zip.setYPosition("100");

 List<Zip> zipTabs = new ArrayList<Zip>();      
 zipTabs.add(zip);
 tabs.setZipTabs(zipTabs);


 //Email Tabs
 Email email = new Email();
 email.setDocumentId("1");
 email.setPageNumber("1");
 email.setRecipientId("1");
 email.setXPosition("300");
 email.setYPosition("100");

 List<Email> emailTabs = new ArrayList<Email>();      
 emailTabs.add(email);
 tabs.setEmailTabs(emailTabs);

 Signer signer = new Signer();
 signer.setEmail(signerEmail);
 signer.setName(signerName);
 signer.setRecipientId("1"); 
 signer.setTabs(tabs);

Upvotes: 1

Related Questions