rgseaug77 | Posts: 6

How do I add an email validation in my text tag? "Without using signature builder"

0 votes

How do I add an email validation in my text tag? "Without using signature builder"


Duo_Liang | Posts: 3776

Reply to: How do I add an email validation in my text tag? "Without using signature builder"

0 votes

Hi 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


Hello! Looks like you're enjoying the discussion, but haven't signed up for an account.

When you create an account, we remember exactly what you've read, so you always come right back where you left off