How do I add an email validation in my text tag? "Without using signature builder"
Tuesday, June 8, 2021 at 04:18pmHow do I add an email validation in my text tag? "Without using signature builder"
How do I add an email validation in my text tag? "Without using signature builder"
Reply to: How do I add an email validation in my text tag? "Without using signature builder"
Wednesday, June 9, 2021 at 09:04amHi rgseaug77,
You can find all the available parameters in the Text tag Extraction guide, however to add an email validator is not directly supported. You'll have to achieve it in separate steps:
(1) when uploading document, define the field name (as well as field ID)
(2) before sending the package, retrieve the field, add an email validator, then update the field
(3) send the package
Not sure if you are developing with REST API or SDK, but the logic could be similar to below Java SDK code (assume you have such text tag in your PDF {{esl_emailField:Signer1:textfield}}):
EslClient eslClient = new EslClient(API_KEY, API_URL);
//STEP1: create a draft package
DocumentPackage pkg = PackageBuilder.newPackageNamed("Text Tag Example Transaction")
.withStatus(PackageStatus.SENT)
.withSigner(SignerBuilder.newSignerWithEmail("[email protected]")
.withFirstName("John")
.withLastName("Smith")
.withCustomId("Signer1"))
.withDocument(DocumentBuilder.newDocumentWithName("Sample Contract")
.fromFile("path_to_your_document")
.withExtractionType(ExtractionType.TEXT_TAGS)
.enableExtraction())
.withStatus(PackageStatus.DRAFT)
.build();
PackageId createPackageOneStep = eslClient.createPackageOneStep(pkg);
//STEP2: update the field with email validator
DocumentPackage pkg1 = eslClient.getPackage(createPackageOneStep);
Document document = pkg1.getDocument("Sample Contract");
for (Signature signature : document.getSignatures()) {
for (Field field : signature.getFields()) {
if("emailField".equals(field.getName())) {
field.setFieldValidator(FieldValidatorBuilder.email().build());
eslClient.getApprovalService().updateField(createPackageOneStep, document.getId().getId(), signature.getId(), field);
break;
}
}
}
//STEP3: send package
eslClient.sendPackage(createPackageOneStep);
Duo