yashpore77 | Posts: 2

Creating group of multiple signature or initial fields where signer can sign one of them

0 votes

We have a scenario where user should initial on one of the signature fields from a group of fields (like a radio button group). We have multiple questions where we want the signer to initial on one choice. 
e.g.

Option 1: initial here Yes ....
OR
Option2: initial here No ....

We are using Java SDK v11.48.

How can we achieve that? 


Duo_Liang | Posts: 3776

Reply to: Creating group of multiple signature or initial fields where signer can sign one of them

0 votes

Hi Yash,

 

Thanks for your post! Below is an example of a document with two signatures and two radio buttons. Toggle option_yes will enable signature_yes, and mark signature_no as optional:
condition: document['document1'].field['option_yes'].value == 'X'

action: document['document1'].field['signature_yes'].disabled = false

           document['document1'].field['signature_no'].required = false

And a similar logic applies to option_no. Let me know how this example works for you.

 

         FieldCondition condition1 = FieldConditionBuilder.newFieldCondition()
                 .withId("Condition1")
                 .withCondition("document['document1'].field['option_yes'].value == 'X'")
                 .withAction("document['document1'].field['signature_yes'].disabled = false")
                 .build();
         FieldCondition condition2 = FieldConditionBuilder.newFieldCondition()
                  .withId("Condition1")
                  .withCondition("document['document1'].field['option_yes'].value == 'X'")
                  .withAction("document['document1'].field['signature_no'].required = false")
                  .build();
         FieldCondition condition3 = FieldConditionBuilder.newFieldCondition()
                 .withId("Condition2")
                 .withCondition("document['document1'].field['option_no'].value == 'X'")
                 .withAction("document['document1'].field['signature_no'].disabled = false")
                 .build();
         FieldCondition condition4 = FieldConditionBuilder.newFieldCondition()
                  .withId("Condition2")
                  .withCondition("document['document1'].field['option_no'].value == 'X'")
                  .withAction("document['document1'].field['signature_yes'].required = false")
                  .build();
         DocumentPackage pkg = PackageBuilder.newPackageNamed("Test Conditional Fields")
                 .describedAs("Description")
                 .withSigner(SignerBuilder.newSignerWithEmail("[email protected]")
                         .withFirstName("Patty")
                         .withLastName("Galant"))
                 .withDocument(DocumentBuilder.newDocumentWithName("Document")
                         .withId("document1")
                         .fromFile("your_file_path")
                         .withSignature(SignatureBuilder.initialsFor("[email protected]")
                                 .withId(new SignatureId("signature_yes"))
                                 .onPage(0)
                                 .atPosition(100, 200)
                                 .withField(FieldBuilder.radioButton("radio_group1")
                                         .withId(new FieldId("option_yes"))
                                         .onPage(0)
                                         .atPosition(400, 200)
                                         .withSize(10, 10)
                                         .withValidation(FieldValidatorBuilder.basic().required())
                                         .withValue("X")
                                         )
                                 .withField(FieldBuilder.radioButton("radio_group1")
                                         .withId(new FieldId("option_no"))
                                         .onPage(0)
                                         .atPosition(400, 300)
                                         .withSize(10, 10)
                                         )
                             )
                         .withSignature(SignatureBuilder.initialsFor("[email protected]")
                                 .withId(new SignatureId("signature_no"))
                                 .onPage(0)
                                 .atPosition(100, 300)
                          )
                    )
                 .withCondition(condition1)
                 .withCondition(condition2)
                 .withCondition(condition3)
                 .withCondition(condition4)
                 .withStatus(PackageStatus.SENT)
                 .build();

         PackageId pkgId = eslClient.createPackageOneStep(pkg);

 

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