gyurko | Posts: 27

Field Injection, FieldBuilder.DropList, and Lists

0 votes

In a previous thread called "General Question on eSign and PDF forms" I recently wrote a reply:

A Form can have some interactive capabilities but only through the Field Validator?  I uploaded an Adobe PDF Form with drop-down lists into my Sandbox instance and notice that all of the Fields are locked down and the drop-downs are disabled.  For instance, in the PDF Form I have a Field called "RoutingType' with 3 choices (BGPDirect or Static).  Anything else is invalid.

Duo Liang replied:

For an OneSpan Sign List field, after signing, OneSpan Sign document engine only stamps the chosen option to the PDF; Unlike Adobe List Box, which lists all the options and highlights the chosen option.

So if you have the control to modify the PDF, you can remove the Adobe List Box and create an OneSpan Sign List Field instead, an example JSON for a list field could look like... and proceed to show json Code.

Here is my question:

I am using .Net Code and only see Field Injection and the FieldBuilder.DropList Method.  I have successfully injected Fields into the PDF using ".WithInjectedField(FieldBuilder.TextField()"

I do not see anything about A "OneSpan Sign List Field."  Either in the Code or anywhere in Forums and Documentation.  I am also at a loss how to build the DropList in the .Net Sdk because of a lack of Documentation.  Can you please assist me?

 


Duo_Liang | Posts: 3776

Reply to: Field Injection, FieldBuilder.DropList, and Lists

0 votes

 Hi gyurko,

 

Thanks for the post! Use below .NET SDK code to create a list field:                         

 

Field dropDownList = FieldBuilder.DropList()
                                              .WithValidation(FieldValidatorBuilder.Basic()
                                                              .WithOption("optionA")
                                                              .WithOption("optionB")
                                                              .WithOption("optionC")
                                                              .Build())

                                               .Build();

 

From JSON's perspective, the options are hosted as "enums" attributes in Field Validators.

 

Duo


gyurko | Posts: 27

Reply to:

0 votes

Thank you.  This is very helpful.  Can I inject this into a PDF Form Field or do I need to Anchor it? 

 

At what point do I create the Field?  This appears to be different than a Custom Field on the Account.  Is that correct?


gyurko | Posts: 27

Reply to: Field Injection, FieldBuilder.DropList, and Lists

0 votes

I figured it out:

 

                Document = new Document();

                using (var fileStream = new FileStream(Path, FileMode.Open, FileAccess.Read))
                    {
                        MemoryStream msInt1 = new MemoryStream();
                        fileStream.CopyTo(msInt1);
                        MemoryStream msInt = new MemoryStream(((MemoryStream)msInt1).ToArray());
                        msInt1.Dispose();
                        DoctoUpload = GetNewDocumentInternet(PreOrderNumber, PreOrderId, GetFirstName, GetLastName, GetEmail, "Rider", SOF, OrgName, ref msInt, DTGetData);
                    }
                    DocName = DoctoUpload.Name;
                    SignatureId RiderId = DoctoUpload.Signatures[0].Id;

                    // Upload Document first

                    eslClient.UploadDocument(DoctoUpload, ESignId);

                    // Build first Droplist
                    Silanis.ESL.SDK.Field IPv4WanBlockSize = FieldBuilder.DropList()
                        .WithValidation(FieldValidatorBuilder.Basic()
                            .WithOption("Please Select")
                            .WithOption("/30 - (1 usable for Licensee)")
                            .WithOption("/29 - (5 usable for Licensee)")
                        .Build())
                        .WithId("IPv4WanBlockSizeId")
                        .WithSize(210, 25)
                        .WithFontSize(12)
                        .OnPage(1)
                        .AtPosition(270, 192)
                    .Build();

                    // Add Field to Document

                    String IPV4FieldId = eslClient.ApprovalService.AddField(ESignId, DoctoUpload.Id, RiderId, IPv4WanBlockSize);

                     // Build second Droplist

                     Silanis.ESL.SDK.Field IPv4LanBlockSize = FieldBuilder.DropList()
                        .WithValidation(FieldValidatorBuilder.Basic()
                            .WithOption("Please Select")
                            .WithOption("/29 - 6 usable IPs)")
                            .WithOption("/28 - 14 usable IPs")
                            .WithOption("/27 - 30 usuable IPs")
                            .WithOption("/26 - 62 usable IPs")
                            .WithOption("/25 - 126 usable IPs")
                            .WithOption("/24 - 254 usable IPs")
                        .Build())
                        .WithId("IPv4LanBlockSizeId")
                        .WithSize(210, 25)
                        .WithFontSize(12)
                        .OnPage(1)
                        .AtPosition(270, 224)
                    .Build();

                    // Add second Field to Document
                    String IPV4FieldId2 = eslClient.ApprovalService.AddField(ESignId, DoctoUpload.Id, RiderId, IPv4LanBlockSize);
 

And so on.  With the Document looking like the attached


Attachments

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